comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Proposed change to BC iterator parameters
Date: 17 Dec 2003 15:59:51 -0500
Date: 2003-12-17T15:59:51-05:00	[thread overview]
Message-ID: <wccllpbcg8o.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: outCb.1286$Pg1.830@newsread1.news.pas.earthlink.net

Jeffrey Carter <spam@spam.com> writes:

> Robert A Duff wrote:
> 
> > Jeffrey Carter <spam@spam.com> writes:
> >
> >>I agree with Duff in general, but in the case of providing iteration
> >>over a protected structure, one must use an access-to-subprogram
> >> parameter.
> > I don't understand.  Why can't one use the usual generic-iterator idea
> > in that case?  Maybe I don't understand what you mean by "protected
> > structure"...
> > Maybe you could give an example?
> 
> See, for example, the Queue_Bounded structure in AI-302-01, in which the
> queue is a protected type (section A.X.6).

Ah, now I get it.  Thanks.

You want to pass a procedure to a protected procedure.  You can't make
the protected procedure generic, which would be the normal thing to do
in the non-protected case.  So you have to pass an extra context
parameter.  That technique works, but it gets pretty ugly at the call
site.  (I'm not blaming you -- the language is forcing you into a
corner!)  Also, you lose compile-time type checking -- the caller passes
in an object of a specific type derived from Context_Data, and the
loop-body procedure must downcast that, causing a run-time check.

I wonder if it might not be a good idea to add a generic wrapper for all
that?

Then you probably wouldn't want the nonprotected versions to use this
same interface.

I'm still pushing for downward closures to be added to the language,
which would add at least a minimal amount of support for iterators,
and greatly simplify this and other data-structure proposals.

An unrelated question about that AI: Why not combine the protected and
blocking versions?

(I really should review this AI carefully sometime...  It would be very
nice to get a data structure library into some future version of the
language.)

- Bob



  reply	other threads:[~2003-12-17 20:59 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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-23 10:40 amado.alves
2003-12-19 15:53 amado.alves
2003-12-19 23:05 ` Robert A Duff
2003-12-11 16:02 amado.alves
2003-12-11 15:05 ada_wizard
2003-12-11 16:45 ` Robert A Duff
2003-12-11 12:56 amado.alves
2003-12-17 20:25 ` Robert A Duff
2003-12-11 12:43 amado.alves
2003-12-11 12:33 amado.alves
2003-12-10 14:39 amado.alves
2003-12-10  5:46 Simon Wright
2003-12-10 18:12 ` Jeffrey Carter
2003-12-11 16:10   ` Martin Krischik
2003-12-10 20:59 ` Simon Wright
replies disabled

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