comp.lang.ada
 help / color / mirror / Atom feed
From: "Robert I. Eachus" <rieachus@comcast.net>
Subject: Re: iterators as  first class objects
Date: Mon, 22 Dec 2003 16:37:15 -0500
Date: 2003-12-22T16:37:15-05:00	[thread overview]
Message-ID: <Uo2dnYAkALyR-XqiRVn-gQ@comcast.com> (raw)
In-Reply-To: <mailman.155.1072110014.31149.comp.lang.ada@ada-france.org>

Lionel.DRAGHI@fr.thalesgroup.com wrote:

> 2 - within the component, the whole array is build: with an iterator, you
> may exit before the end.
> 
> This is why we use it only for small data structure. 
> 
> As this leads to crystal-clear user's code, and as it's a common need, I
> think it's worth thinking about langage extension.

Which is why, as I said elsewhere I usually provide both the array view 
and a global next operation.  It is not an iterator because it removes 
the object from the structure before returning it.

If you want to think of this as an array view, and a queue view, fine, 
although the Next operation maps well to all data structures.  (If the 
user doesn't care about order (a bag) he still gets one item at a time 
with no repetition.


-- 
                                           Robert I. Eachus

"The war on terror is a different kind of war, waged capture by capture, 
cell by cell, and victory by victory. Our security is assured by our 
perseverance and by our sure belief in the success of liberty." -- 
George W. Bush




      reply	other threads:[~2003-12-22 21:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-22 16:19 iterators as first class objects Lionel.DRAGHI
2003-12-22 21:37 ` Robert I. Eachus [this message]
replies disabled

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