iterators as first class objects
Lionel.DRAGHI_at_fr.thalesgroup.com
Date: 12/22/03
- Next message: Ekkehard Morgenstern: "Re: [announcement] SYSAPI and SYSSVC for Windows"
- Previous message: Mark H Johnson: "Re: load and use a ".o" file?"
- Next in thread: Robert I. Eachus: "Re: iterators as first class objects"
- Reply: Robert I. Eachus: "Re: iterators as first class objects"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 22 Dec 2003 17:19:22 +0100 To: comp.lang.ada@ada-france.org
| -----Message d'origine-----
| De: Robert I. Eachus
...
| But the trick of having data structure packages return an
| array view of
| a collection, or actually an array of access values, is very, very
| useful.
I also really like this idiom, but there are drawbacks:
1 - you get more job done:
First within the data structure component, you have to build the array.
If the internal structure is not already an array, you will probably need an
actual iterator.
Then, within the user's code, there is the "for i in " loop.
With an iterator, there is only one loop.
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.
-- Lionel Draghi
- Next message: Ekkehard Morgenstern: "Re: [announcement] SYSAPI and SYSSVC for Windows"
- Previous message: Mark H Johnson: "Re: load and use a ".o" file?"
- Next in thread: Robert I. Eachus: "Re: iterators as first class objects"
- Reply: Robert I. Eachus: "Re: iterators as first class objects"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|