comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Intervention needed?
Date: Sat, 23 Mar 2019 03:03:13 -0500
Date: 2019-03-23T03:03:13-05:00	[thread overview]
Message-ID: <q74p82$hrg$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: 0e27ab0a-5daa-45b0-ae5c-a2441fb1ad40@googlegroups.com

The classic (and rare) example of a limited type is one containing a task. 
For those, you do need to control initialization. You also need to do so if 
the type has any discriminants.

I suppose it would be possible to do in a sense by defining *exactly* what 
every operation must do (essentially by providing the body) -- but then 
there is no reason to standardize it, because there is no value to be added 
by an implementer. (Anyone can download a library from github or whatever 
and compile with with whatever compiler you want.)

This is the same sort of reason it doesn't make much sense to allow 
user-defined storage pools in a container -- you would have to precisely 
define what allocators are going to do (in terms of allocation sizes, 
ordering,  and the like) so that a pool could take advantage of that. But 
then there's really nothing for the implementation to do - the package is so 
heavily specified that there is no freedom to improve the implementation.

                   Randy.

"Jere" <jhb.chat@gmail.com> wrote in message 
news:0e27ab0a-5daa-45b0-ae5c-a2441fb1ad40@googlegroups.com...
> On Thursday, March 21, 2019 at 10:00:41 PM UTC-4, Randy Brukardt wrote:
>> "Jere" wrote in message
>> ...
>> > You would think that a container of limited types would be very
>> > restrictive,
>> > but with the advent of Implicit_Dereference and reference types, there
>> > is definitely some meat there.  I would say maps and lists are the two
>> > areas I find the most need.
>>
>> A container of a limited type would be very restrictive. ;-)
>>
>> Several of us (including me) have tried to imagine how a container of
>> limited objects would work, but it just doesn't make much sense. The 
>> primary
>> problem is that one cannot control the lifetime of objects in a 
>> container,
>> which includes the problem that one can't control the initialization of
>> objects in a container. Whereas for non-limited objects, one just 
>> replaces
>> them with the right data, you can't do that for a limited object. And 
>> since
>> the initialization needs are type-dependent, there's no good way to deal
>> with it in a type-safe manner. (A constructor with an unknown set of
>> parameters isn't going to be type-safe, and with any particular set of
>> parameters is too limiting.
>>
>
> Yes constructors pose a problem.  The way I work around it is similar to
> how Generic_Dispatching_Constructors does.  I let them define a parameter
> which could be a record of parameters.
>
> That said, it usually doesn't matter for limited types. When I have had to
> make and use containers of limited types, I am in one of two places:
>
> 1.  The limited type was only made limited because of a component or two
> so the designer created a copy procedure.  This lets me mostly treat
> limited types the same as non limited types.  I've literally taken a GNAT
> container, added a copy procedure formal to the generic, and integrated
> it into the business logic whereever the compiler told me it couldn't
> copy a limited type.  So far that has worked flawlessly, but I don't
> know if the customer has tried all of the various functions in the
> containers.  This is the less likely case however.
>
> 2.  I don't worry about integrating initialization.  I just have the
> container create a default object, and then I can use the combination
> of cursors and references (or simply a "for of" loop) and initialize
> them after adding them.  So yes, definitely more restrictive than
> a non limited type container.  I just meant the restrictions were
> not as insurmountable as I have seen in discussions before.  This
> is the more often case.  This doesn't 100% cover all remaining cases
> (like ones where you have to initialize the object at creation),
> but it has been the remaining 95% solution and very effective.  In
> one case I created a package with the same operations as the customer's
> but implemented the logic as an Ordered_Map of limited types instead
> of the array logic they were using, and it increased their through
> put by 3x (they did a lot of manual searching).  It also happened
> to get a couple of their own programmers to rethink on how they
> perceived Ada to be an "old" language (very pervasive thought
> where I work).  They had no idea that you could even make iterators
> in Ada.  A couple didn't even know you could do dynamic dispatching
> as they started in Ada83 and never grew past that. 



  reply	other threads:[~2019-03-23  8:03 UTC|newest]

Thread overview: 146+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-08 16:43 Intervention needed? Olivier Henley
2019-03-08 16:58 ` Dmitry A. Kazakov
2019-03-08 17:31 ` gautier_niouzes
2019-03-11 14:31   ` antispam
2019-03-11 15:07     ` gautier_niouzes
2019-03-11 17:19     ` Dmitry A. Kazakov
2019-03-11 15:34 ` Lucretia
2019-03-11 17:30   ` Simon Wright
2019-03-11 17:42     ` Dmitry A. Kazakov
2019-03-11 18:14       ` AdaMagica
2019-03-11 19:52   ` Olivier Henley
2019-03-11 20:04     ` Lucretia
2019-03-11 22:08   ` Jeffrey R. Carter
2019-03-12  2:04     ` Lucretia
2019-03-12 13:17       ` Olivier Henley
2019-03-12 16:32       ` Jeffrey R. Carter
2019-03-12 16:56         ` Lucretia
2019-03-12 17:20           ` Lucretia
2019-03-12 18:14         ` Olivier Henley
2019-03-12 19:21           ` Lucretia
2019-03-12 21:53             ` Randy Brukardt
2019-03-13 10:50               ` Jere
2019-03-17 12:52               ` Optikos
2019-03-17 16:37                 ` Luke A. Guest
2019-03-17 16:48                 ` Paul Rubin
2019-03-20  0:49                   ` Optikos
2019-03-20  1:04                     ` Paul Rubin
2019-03-20  1:19                       ` Optikos
2019-03-18 23:36                 ` Randy Brukardt
2019-03-19  2:18                   ` Optikos
2019-03-19  8:44                     ` Dmitry A. Kazakov
2019-03-19  9:53                       ` Optikos
2019-03-19 22:13                         ` Randy Brukardt
2019-03-19 22:26                           ` Paul Rubin
2019-03-20  1:08                             ` Jere
2019-03-22  2:26                               ` Randy Brukardt
2019-03-23 15:56                                 ` Jeffrey R. Carter
2019-03-23 21:38                                   ` Paul Rubin
2019-03-19 22:36                           ` Optikos
2019-03-19 23:13                             ` Randy Brukardt
2019-03-20  1:28                               ` Jere
2019-03-20  8:42                                 ` Dmitry A. Kazakov
2019-03-22  2:00                                 ` Randy Brukardt
2019-03-22 11:10                                   ` Jere
2019-03-23  8:03                                     ` Randy Brukardt [this message]
2019-03-23 21:32                                       ` Jere
2019-03-20  7:59                               ` Optikos
2019-03-22  2:16                                 ` Randy Brukardt
2019-03-22  8:38                                   ` Optikos
2019-03-22 10:54                                     ` Jere
2019-03-23  7:53                                       ` Randy Brukardt
2019-03-23 13:59                                         ` Jere
2019-03-23 21:19                                           ` Jere
2019-03-23 21:29                                             ` Paul Rubin
2019-03-26  8:09                                           ` Optikos
2019-03-20  1:20                           ` Jere
2019-03-22  2:30                             ` Randy Brukardt
2019-03-22  9:08                               ` Dmitry A. Kazakov
2019-03-22 22:23                                 ` Optikos
2019-03-27 19:20                                   ` G. B.
2019-03-27 21:02                                     ` Paul Rubin
2019-03-28  7:01                                       ` Maciej Sobczak
2019-03-28  7:17                                         ` Paul Rubin
2019-03-28  8:39                                           ` Simon Wright
2019-03-30  4:31                                             ` Paul Rubin
2019-03-30 22:14                                           ` Robert A Duff
2019-03-30 22:55                                             ` Paul Rubin
2019-03-28  9:06                                         ` Dmitry A. Kazakov
2019-03-28 20:48                                           ` G. B.
2019-03-29  5:13                                             ` Bojan Bozovic
2019-03-29  8:13                                               ` Dmitry A. Kazakov
2019-03-29  6:57                                           ` Maciej Sobczak
2019-03-29  7:13                                             ` Paul Rubin
2019-03-29  8:39                                             ` Dmitry A. Kazakov
2019-04-01 15:13                                               ` Optikos
2019-04-01 16:51                                                 ` Dmitry A. Kazakov
2019-04-01 21:42                                                   ` Randy Brukardt
2019-04-02  8:30                                                     ` Dmitry A. Kazakov
2019-04-02 15:53                                                       ` Anh Vo
2019-03-19 22:04                       ` Randy Brukardt
2019-03-19 22:22                         ` Paul Rubin
2019-03-19 23:01                           ` Randy Brukardt
2019-03-19  9:37                     ` Optikos
2019-03-19 22:21                       ` Randy Brukardt
2019-03-29 17:56                   ` Florian Weimer
2019-03-29 22:17                     ` Randy Brukardt
2019-03-29 22:35                       ` Florian Weimer
2019-04-01 21:17                         ` Randy Brukardt
2019-03-29 17:41               ` Florian Weimer
2019-03-29 22:16                 ` Randy Brukardt
2019-03-29 22:43                   ` Florian Weimer
2019-04-01 21:29                     ` Randy Brukardt
2019-04-01 22:14                       ` Simon Wright
2019-04-02 21:55                         ` Randy Brukardt
2019-04-04 15:07                           ` Simon Wright
2019-03-12 21:41         ` Randy Brukardt
2019-03-13  9:10     ` Maciej Sobczak
2019-03-13 11:08       ` Jere
2019-03-13 11:11         ` Jere
2019-03-13 11:59         ` Jere
2019-03-13 13:44       ` Olivier Henley
2019-03-13 15:56         ` Simon Wright
2019-03-13 16:25           ` Olivier Henley
2019-03-14  0:40             ` Simon Wright
2019-03-13 16:27           ` Olivier Henley
2019-03-14 22:41         ` Randy Brukardt
2019-03-16 21:30           ` Olivier Henley
2019-03-29 17:38     ` Florian Weimer
2019-03-13 13:23 ` Olivier Henley
2019-03-22 11:10 ` Lucretia
2019-03-22 14:09   ` J-P. Rosen
2019-03-22 16:41   ` Jeffrey R. Carter
2019-03-22 17:29     ` Paul Rubin
2019-03-22 22:36       ` Optikos
2019-04-01  7:28 ` gautier_niouzes
  -- strict thread matches above, loose matches on Subject: below --
2019-03-25 19:14 Randy Brukardt
2019-03-25 20:44 ` Dmitry A. Kazakov
2019-03-28  0:48 ` Jere
2019-04-02 22:07 Randy Brukardt
2019-04-03  7:29 ` Dmitry A. Kazakov
2019-04-03 14:31   ` Optikos
2019-04-03 14:54     ` Dmitry A. Kazakov
2019-04-03 15:29       ` Optikos
2019-04-03 16:16       ` Simon Wright
2019-04-03 17:15         ` Dmitry A. Kazakov
2019-04-03 21:12           ` Simon Wright
2019-04-04  7:09             ` Dmitry A. Kazakov
2019-04-04  5:44           ` Maciej Sobczak
2019-04-04  7:17             ` Dmitry A. Kazakov
2019-04-04  7:22             ` Paul Rubin
2019-04-04  8:37               ` Niklas Holsti
2019-04-05  0:13                 ` Randy Brukardt
2019-04-05  5:45                 ` Maciej Sobczak
2019-04-05 15:17                   ` Optikos
2019-04-06  1:38                     ` Jere
2019-04-06  4:25                       ` alby.gamper
2019-04-06  6:49                         ` Jere
2019-04-06  8:24                           ` alby.gamper
2019-04-04 12:28             ` Simon Wright
2019-04-04 16:17           ` Optikos
2019-04-03 15:07 ` Lucretia
2019-04-03 16:15   ` Simon Wright
2019-04-03 17:23 ` Niklas Holsti
2019-04-03 17:48   ` Bill Findlay
2019-04-03 21:01   ` Simon Wright
2019-04-03 18:58 ` Dennis Lee Bieber
replies disabled

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