comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: class wide iterable (and indexable)
Date: Tue, 15 Jan 2019 10:34:18 +0100
Date: 2019-01-15T10:34:18+01:00	[thread overview]
Message-ID: <q1k9ep$aku$1@gioia.aioe.org> (raw)
In-Reply-To: q1j489$oo8$1@franka.jacob-sparre.dk

On 2019-01-14 23:59, Randy Brukardt wrote:

> Perhaps, but then you can't build anything really generic (like the
> containers or Direct_IO).

Especially them! Generics have no place in containers and I/O. It is 
pure insanity.

> Forcing everything into a class just for the sake
> of that just replaces one set of problems with a different set.

Generics types form classes. You cannot avoid classes, you only can 
change the means of building them.

>> It is the same mechanism that is used for passing array bounds. And if
>> statically known (and all parents are abstract) the constraint can be
>> eliminated altogether, again like with arrays. You might be required to
>> adjust inherited operations, but again, this is no different from what you
>> do with shared generic bodies.
> 
> Sure, but passing array bounds is pretty expensive. It's certainly more
> expensive than having a tag component, at least unless the number of objects
> number of calls. Again, you're just trading one set of costs for a
> different set.

I mean that when array is statically constrained bounds are removed. The 
case with containers that the element type is constrained and the same 
mechanism can be used to avoid overhead.

>>> Ada probably can't use the separate tag model because of its insistence
>>> on
>>> supporting redispatching, even in inherited routines. I think you've
>>> convinced me that model was a mistake, but like many things in existing
>>> Ada,
>>> we're stuck with it short of a drastic (not completely compatible)
>>> redesign.
>>
>> There is no view conversions for such types, they are by-value. Thus no
>> way to even spell re-dispatch. Conversion to Parent'Class will create a
>> new object.
> 
> Not necessarily, since we're also talking about untagged composite types.
> One hopes that we're not going to force strings or coordinates to be passed
> by copy (that would cause a lot of extra copying).

It is OK. But that would not bring view conversion back. The tag will be 
taken from the designated data type and tag + reference will passed as 
class-wide. It is tag + value or tag + reference, the semantics will be 
same.

>> Interfaces should be allowed to be additive with the corresponding rules
>> to resolve conflicting implementations. There is an obvious contradiction
>> between invisibility and idempotence, e.g. if one entity is visible and
>> other is not. Let them add up and require conflict resolution in the
>> contexts where both become visible.
> 
> What would that look like? Currently, you can only resolve conflicts with
> type names, and that certainly would not be enough in this case (the name of
> the interface being the same for every copy, as well as the type that has
> all of these interfaces). Numbering isn't going be reliable (the number of
> copies could differ for every view). So how could you deal with such
> conflicts?

I don't know. There should be some nice syntax invented to replace 
conflicting names (of interfaces + their operations and members) at the 
type declaration point.

>> No, I don't believe that either. See how people keep on creating C. There
>> is a dozen of C-like languages redesigned from scratch, but the warts are
>> all there.
> 
> The people doing that like a lot of about C already (why the mass hysteria
> on that, I don't know. Perhaps they don't even know that you can do
> better?). If I personally redesigned Ada, it would be a lot like the current
> Ada with some warts removed (strings and arrays in particular).

See, that is the same mindset! (:-))

> I generally
> like the way Ada works, as I'm sure you know; I don't think a lot needs to
> be done to the type system. Clearly your vision is rather different.

I think that the type system must be generalized and extended, not 
changed. What you say about strings and arrays is what I would as well. 
But I would simply make them library-level things because the extended 
type system would be capable to make them such.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


  reply	other threads:[~2019-01-15  9:34 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-02 15:48 class wide iterable (and indexable) George Shapovalov
2019-01-02 17:39 ` Simon Wright
2019-01-02 18:11   ` George Shapovalov
2019-01-03  8:52     ` Simon Wright
2019-01-03  9:30       ` George Shapovalov
2019-01-03 16:45         ` Jeffrey R. Carter
2019-01-04  4:32       ` Shark8
2019-01-05  9:03         ` Randy Brukardt
2019-01-03 22:56     ` Randy Brukardt
2019-01-04  0:00       ` George Shapovalov
2019-01-04  8:43         ` Dmitry A. Kazakov
2019-01-04 12:20           ` George Shapovalov
2019-01-05 23:29             ` Jere
2019-01-05 23:50               ` Jere
2019-01-06  9:34                 ` George Shapovalov
2019-01-06 10:19                   ` Dmitry A. Kazakov
2019-01-06 11:30                     ` George Shapovalov
2019-01-06 12:45                       ` Dmitry A. Kazakov
2019-01-06 13:18                         ` George Shapovalov
2019-01-06 14:13                           ` Dmitry A. Kazakov
2019-01-06 16:33                             ` George Shapovalov
2019-01-06 18:29                               ` George Shapovalov
2019-01-06 20:32                                 ` Dmitry A. Kazakov
2019-01-06 21:47                                   ` George Shapovalov
2019-01-07  9:37                                     ` Niklas Holsti
2019-01-07 16:24                                       ` George Shapovalov
2019-01-06 20:18                               ` Dmitry A. Kazakov
2019-01-06 21:58                                 ` George Shapovalov
2019-01-07  8:28                                   ` Dmitry A. Kazakov
2019-01-05  9:21           ` Randy Brukardt
2019-01-05 10:07             ` Dmitry A. Kazakov
2019-01-05 18:17               ` George Shapovalov
2019-01-05 20:07                 ` Simon Wright
2019-01-05 20:41                   ` George Shapovalov
2019-01-07 21:07               ` Randy Brukardt
2019-01-08  9:51                 ` Dmitry A. Kazakov
2019-01-08 19:25                   ` Björn Lundin
2019-01-08 23:26                   ` Randy Brukardt
2019-01-09 17:06                     ` Dmitry A. Kazakov
2019-01-09 23:38                       ` Randy Brukardt
2019-01-10  8:53                         ` Dmitry A. Kazakov
2019-01-10 22:14                           ` Randy Brukardt
2019-01-11  9:09                             ` Dmitry A. Kazakov
2019-01-14 22:59                               ` Randy Brukardt
2019-01-15  9:34                                 ` Dmitry A. Kazakov [this message]
2019-01-18 15:48                                   ` Olivier Henley
2019-01-18 16:08                                     ` Dmitry A. Kazakov
2019-01-18 16:29                                       ` Olivier Henley
2019-01-18 16:54                                         ` Dmitry A. Kazakov
2019-01-18 17:31                                           ` Olivier Henley
2019-01-18 18:51                                             ` Shark8
2019-01-18 20:09                                             ` Dmitry A. Kazakov
2019-01-21 23:15                                     ` Randy Brukardt
2019-01-22  8:56                                       ` Dmitry A. Kazakov
2019-01-22 22:00                                         ` Randy Brukardt
2019-01-23  8:14                                           ` Dmitry A. Kazakov
2019-01-22 17:04                                       ` Jeffrey R. Carter
2019-01-22 22:02                                         ` Randy Brukardt
2019-01-23 18:00                                           ` Jeffrey R. Carter
2019-01-23 20:14                                           ` Shark8
2019-01-23 22:47                                             ` Randy Brukardt
2019-01-24 17:11                                               ` Dmitry A. Kazakov
2019-01-28 15:54                                               ` Shark8
2019-01-28 17:23                                                 ` Dmitry A. Kazakov
2019-01-08 18:32                 ` G. B.
2019-01-05 17:05             ` Jeffrey R. Carter
2019-01-05 20:18               ` Dmitry A. Kazakov
2019-01-05 21:09               ` Shark8
2019-01-06 10:11                 ` Jeffrey R. Carter
2019-01-05 20:46             ` Shark8
2019-01-06  9:43               ` Dmitry A. Kazakov
2019-01-26 22:11 ` George Shapovalov
2019-01-26 22:14   ` George Shapovalov
  -- strict thread matches above, loose matches on Subject: below --
2019-01-29  7:45 Randy Brukardt
2019-01-29 19:34 ` Niklas Holsti
2019-01-29 20:26   ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox