comp.lang.ada
 help / color / mirror / Atom feed
* RE: Proposed change to BC iterator parameters
@ 2003-12-10 13:36 amado.alves
  2003-12-10 16:47 ` Proposed change to BC iterator parameters [limitedness] Georg Bauhaus
                   ` (4 more replies)
  0 siblings, 5 replies; 46+ messages in thread
From: amado.alves @ 2003-12-10 13:36 UTC (permalink / raw)
  To: Simon Wright, comp.lang.ada

<<...
   generic
      type Param_Type is private;
      with procedure Apply (Elem : in Item;
                            Param : in Param_Type;
                            OK : out Boolean);
   procedure Visit_With_In_Param (Using : in out Iterator'Class;
                                  Param : in Param_Type);
>>

I've never found a situation where the following much simpler signature wouldn't suffice:

   generic
      with procedure Apply (Elem : in Item);
   procedure Visit_With_In_Param (Using : in out Iterator'Class);

with premature termination of the iteration done by raising inside Apply an exception which Visit_With_In_Param propagates by definition.

<<...      type Param_Type (<>) is limited private;

As I understand it, this allows users much more freedom (you can even
use a tagged type provided you instantiate with Tagged_Type'Class)...>>

Strictly you don't need the limited formal for (unlimited) tagged or class actuals. You need the limited formal for limited actuals, whatever their class. Limitedness is completely orthogonal to definiteness. I do like indefinite formals, but I pass well without limited ones. Most limited formals I've seen in libraries are accompanied by a formal assignment operation or some such, which prety much defeats the purpose of their (formal) limitedness, i.e. their logic is in clash with their definition.




^ permalink raw reply	[flat|nested] 46+ messages in thread
* RE: Proposed change to BC iterator parameters [limitedness]
@ 2003-12-10 17:53 amado.alves
  2003-12-10 18:47 ` Georg Bauhaus
  2003-12-11 15:48 ` Robert A Duff
  0 siblings, 2 replies; 46+ messages in thread
From: amado.alves @ 2003-12-10 17:53 UTC (permalink / raw)
  To: comp.lang.ada

<<Sometimes I dearly wanted limited records but was defeated
by the library that could not store them (storing them was the
intention):...>>

I think there are (container) libraries that accept limited element types. And some libs that dont can easily (?) be changed in that direction. But as I indicated I think it is 'unatural' to store values of a limited type. For me it does not make sense to put constants in a container. So my advice can only be: rethink your program.




^ permalink raw reply	[flat|nested] 46+ messages in thread
* RE: Proposed change to BC iterator parameters [limitedness]
@ 2003-12-10 19:20 amado.alves
  2003-12-11 13:10 ` Marin David Condic
  0 siblings, 1 reply; 46+ messages in thread
From: amado.alves @ 2003-12-10 19:20 UTC (permalink / raw)
  To: comp.lang.ada

<<: I think there are (container) libraries that accept limited
element types.

Charles does (some of it).>>

So perhaps you should consider using it.

<<
: ...For me it does not make sense
: to put constants in a container. So my advice can only be: rethink
: your program.

I tried, limitedness is only an implication of having access
discriminants in tagged types...>>

I know. Big annoyance of Ada. The root of all 'unnaturalness'. Often I also end up specifying things 'above' the language like you did with "Make".




^ permalink raw reply	[flat|nested] 46+ messages in thread
* RE: Proposed change to BC iterator parameters [limitedness]
@ 2003-12-10 19:33 amado.alves
  0 siblings, 0 replies; 46+ messages in thread
From: amado.alves @ 2003-12-10 19:33 UTC (permalink / raw)
  To: comp.lang.ada

<<
  type T
    (look_here: access D;
     look_there: access E;
     and_also_over_there: access D)
  is tagged limited...
>>

Since your working with a container library anyway a cleaner solution might be to create containers for types D and E and replace the access discriminants above with the corresponding pointers (iterators).




^ permalink raw reply	[flat|nested] 46+ messages in thread
* RE: Proposed change to BC iterator parameters [limitedness]
@ 2003-12-11 16:24 amado.alves
  2003-12-11 16:53 ` Robert A Duff
  0 siblings, 1 reply; 46+ messages in thread
From: amado.alves @ 2003-12-11 16:24 UTC (permalink / raw)
  To: comp.lang.ada

<<
> I think there are (container) libraries that accept limited element
> types. And some libs that dont can easily (?) be changed in that
> direction. But as I indicated I think it is 'unatural' to store values
> of a limited type. For me it does not make sense to put constants in a
> container. So my advice can only be: rethink your program.

Heh?  Limited is not the same thing as constant.>>

I think the original poster wanted limited for logical constants.

<<It makes perfect sense to store limited objects in containers.>>

Not "perfect" to me ;-)

<<*Some* containers require
copying to get the data in and out of the container;>>

Strictly all containers do. The difference is when. At declaration, at elaboration, at run time...

<<... limited components
do not make sense in *that* case.  But other containers can deal with
limited types just fine.

Why do you think Ada allows arrays of tasks?>>

I don't know. I would be happy with pointers to tasks or some such. For uniformity. You can have an array of exceptions ids, but not of exceptions.

<<An array is a container,>>

I can say any object is a container. An uni-elementary one.

<<...and tasks are about as limited as you can get!>>

Yes, unfortunately.




^ permalink raw reply	[flat|nested] 46+ messages in thread

end of thread, other threads:[~2003-12-22  1:25 UTC | newest]

Thread overview: 46+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-10 13:36 Proposed change to BC iterator parameters amado.alves
2003-12-10 16:47 ` Proposed change to BC iterator parameters [limitedness] Georg Bauhaus
2003-12-10 17:39 ` Proposed change to BC iterator parameters Martin Krischik
2003-12-10 18:22 ` Jeffrey Carter
2003-12-10 23:00   ` Robert A Duff
2003-12-11  1:00     ` Jeffrey Carter
2003-12-11 15:09       ` Robert A Duff
2003-12-11  8:33     ` Dmitry A. Kazakov
2003-12-10 20:50 ` Simon Wright
2003-12-10 23:12 ` Robert A Duff
2003-12-11  5:07   ` Steve
2003-12-11 15:24     ` Robert A Duff
2003-12-11 17:39       ` Jeffrey Carter
2003-12-12 22:22         ` Robert A Duff
2003-12-13  0:57           ` Jeffrey Carter
2003-12-17 20:59             ` Robert A Duff
2003-12-18 10:05               ` Dmitry A. Kazakov
2003-12-18 18:14                 ` Robert A Duff
2003-12-19 10:53                   ` Dmitry A. Kazakov
2003-12-19 16:17                     ` Georg Bauhaus
2003-12-19 17:19                       ` Dmitry A. Kazakov
2003-12-19 22:51                         ` Robert A Duff
2003-12-20 12:20                           ` Dmitry A. Kazakov
2003-12-19 22:47                       ` Robert A Duff
2003-12-20  2:11                         ` Stephen Leake
2003-12-20 19:08                         ` Robert I. Eachus
2003-12-21 11:39                           ` Simon Wright
2003-12-21 18:13                             ` Robert I. Eachus
2003-12-21 13:58                           ` Dmitry A. Kazakov
2003-12-22  1:25                             ` Robert I. Eachus
     [not found]         ` <916oa1-c93.ln1@beastie.ix.netcom.com>
2003-12-13 16:57           ` Simon Wright
2003-12-12  5:29     ` Simon Wright
2003-12-12 22:26       ` Robert A Duff
2003-12-13 16:55         ` Simon Wright
2003-12-13 17:27           ` Dmitry A. Kazakov
2003-12-13  2:44       ` Steve
  -- strict thread matches above, loose matches on Subject: below --
2003-12-10 17:53 Proposed change to BC iterator parameters [limitedness] amado.alves
2003-12-10 18:47 ` Georg Bauhaus
2003-12-11 15:48 ` Robert A Duff
2003-12-10 19:20 amado.alves
2003-12-11 13:10 ` Marin David Condic
2003-12-11 17:59   ` Jeffrey Carter
2003-12-12  5:58   ` Simon Wright
2003-12-10 19:33 amado.alves
2003-12-11 16:24 amado.alves
2003-12-11 16:53 ` Robert A Duff

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