comp.lang.ada
 help / color / mirror / Atom feed
From: bobduff@world.std.com (Robert A Duff)
Subject: Re: Translate this into Ada ...
Date: 1996/08/29
Date: 1996-08-29T00:00:00+00:00	[thread overview]
Message-ID: <Dwwq1A.GLt@world.std.com> (raw)
In-Reply-To: 4vfb15$ujr@watnews1.watson.ibm.com


In article <4vfb15$ujr@watnews1.watson.ibm.com>,
Norman H. Cohen <ncohen@watson.ibm.com> wrote:
>It might be more appropriate to make Iterator_Type limited (since it
>represents the state of an in-progress loop iteration, something that it
>does not make sense to copy).  In this case, the New_Iterator_For
>function should be replaced by a procedure Start_Iteration with an out
>parameter of Iterator_Type. ...

How about making it limited, with an access discriminant used to point
at the data structure being iterated over, and make it controlled, with
an Initialize that does whatever initialization is necessary?  Then you
could say:

    It: Iterator_Type(The_Thing_Being_Iterated_Over'Access);
    ...

By the way, finalization can be expensive, but I see no reason why a
controlled type that just overrides Initialize needs to be expensive.
The compiler would have to recognize that special case, of course.

- Bob




  parent reply	other threads:[~1996-08-29  0:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-08-20  0:00 Translate this into Ada Richard Irvine
1996-08-21  0:00 ` David Weller
1996-08-21  0:00 ` Norman H. Cohen
1996-08-22  0:00   ` Richard Irvine
1996-08-22  0:00     ` Richard Irvine
1996-08-22  0:00     ` Norman H. Cohen
1996-08-29  0:00   ` Robert A Duff [this message]
  -- strict thread matches above, loose matches on Subject: below --
1996-08-21  0:00 Spasmo
1996-08-21  0:00 ` Richard Irvine
1996-08-28  0:00   ` Robert A Duff
replies disabled

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