comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: class wide iterable (and indexable)
Date: Wed, 9 Jan 2019 17:38:50 -0600
Date: 2019-01-09T17:38:50-06:00	[thread overview]
Message-ID: <q160mb$863$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: q159mg$1q6k$1@gioia.aioe.org

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message 
news:q159mg$1q6k$1@gioia.aioe.org...
> On 2019-01-09 00:26, Randy Brukardt wrote:
>
>> But that's the point: there aren't any significant tagged classes here, 
>> just
>> generic classes, because there is only one instance of each class (use of
>> formal packages can't change that).
>
> This is what I do not understand. Instance of a class is a type. Do you 
> mean the depth of the hierarch,y probably? Because the number of sibling 
> instances is usually large.

But the siblings are incompatible with each other (different types, as you 
say). So there is no sharing that can be done between them other than that 
which comes directly from the generic unit itself. That makes any interfaces 
(again, Ada interface feature) involved useless, as they're necessarily 
different than any other such interfaces, which means there isn't anything 
that you can do with them. So why have them at all?

...
>> No, I argue that given that there is no realistic alternative (other than 
>> to
>> abandon strong static typing by deriving everything from a common type, 
>> then
>> store Object'Class).
>
> It cannot be Object'Class because that includes limited types etc. There 
> are lots of constraints on the elements depending on the container, like 
> ordering, hashes. These constraints must be spelled in the language, not 
> silently assumed. A named interface is a language to spell such 
> constraints. #1.

Making the elements much more expensive (because of the need to manage an 
expensive tag) than they otherwise would be. There's a lot of pushback on 
even making language-defined units tagged, because of overhead concerns. 
(Don't buy that myself, but that's the mindset.)

Anyway, #1 has to be part of the contract of the generic. Doesn't make sense 
otherwise. And packaging all of the contracts into a single entity has been 
tried in many ways (that's the original reason for formal packages, the 
so-called signature package) -- and it's always too inflexible. Best to just 
have the individual requirements clearly stated in the profile of the 
generic. (I'd have said "interface", meaning the concept, not the feature, 
but that gets too confusing.)

> The instances must be further constrained by the user from his side. Just 
> like we declare an array type, it does not mean that it can hold any 
> elements from the class of definite types. #2.
>
> It seems that you mix constraints #1 with #2.

#1 has to be part of the contract of the generic; #2 clearly is not. Don't 
see any mixing there.

>> If there was a way to have a universal container interface independent of
>> the element type (and have that be useful), then the concept would be a 
>> lot
>> more useful. But that isn't possible in any Ada-like language and retain
>> static typing.
>
> I do not understand why. Create an anonymous instance, clone the 
> hierarchy, constrain Element'Class to the concrete type T. Everything must 
> be done by the compiler in one step as it does for array types.

Well, separate array types are a mistake given that there are many 
implementations for a sequence. It would be better for them to be a 
container just like all of the others. I.e. I'd make it harder to declare an 
array rather making it easier to declare a container. :-)

I discussed anonymous instances elsewhere; they do great damage to the Ada 
model that everything has a place and to readability.

...
>> Which makes sense to me, since the primary benefit of inherited types is
>> implementation reuse. Which interfaces don't allow. I'd surely support 
>> this
>> position, but I think it is impractical to implement (as well as define
>> properly rules for).
>
> Right, this is our main conceptual disagreement. You want to stick to 
> generics though they have proven not working. The only alternative is 
> inheritance (advanced type system). If only one percent of mental efforts 
> were invested into the type system instead, we could have a different and 
> IMO better Ada today.

A different language, but it wouldn't be Ada. There's no way it could be 
compatible enough, to do so would be to do great violence to that "advanced 
type system". Because most of the details of Ada types aren't advanced in 
any sense. :-)

...
>>> I would gladly use Janus/Ada or ObjectAda if I could. I was a happy user
>>> of the latter long ago. Unfortunately cross-platformity is a requirement
>>> in these days.
>>
>> Understood. As you know, that costs $$$, and there aren't enough of those 
>> to
>> go around.
>
> Sure, we need another crazy billionaire who would invest some bits of his 
> unearned wealth into Ada rather than in digging tunnels in seismically 
> active zones... (:-))

Agreed. :-)

               Randy.


  reply	other threads:[~2019-01-09 23:38 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 [this message]
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
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