Article View: comp.lang.misc
Article #5422Re: Iterators
From: Erland Sommarskog
Date: Wed, 30 Mar 1988 07:58
Date: Wed, 30 Mar 1988 07:58
24 lines
1527 bytes
1527 bytes
Stephen Crawley (scc@cl.cam.ac.uk) writes:
>However, Ada does allow you to use procedures as parameters to a generic
>package. As Erland pointed out, this allows you to construct iterators.
>[It is sad that Ada forces you to go to the trouble of constructing a
> generic package for a data structure you want to iterate over.]
Minor correction: A package like a tree handler should always be generic.
But if Ada had had procedure parameters, we wouldn't have been forced
to declare the iterator as a generic procedure.
I don't really want to go into the debate on generic vs. "real"
procedure parameters. I can imagine that the Ada designers felt
procedure parameters as redundant aside with procedures as generic
parameters. But I'm not really fond of declarations like
Generic
With procedure A(P1 : T;
P2 : T2);
Procedure B;
Together with the instantiation this becomes unnecessarily verbose.
The compiler and library overhead is also greater for generics.
--
Erland Sommarskog
ENEA Data, Stockholm
sommar@enea.UUCP
Technical Details
Message-ID:
<2944@enea.se>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!uunet!mcvax!enea!sommarReferences:
<1147@jenny.cl.cam.ac.uk> <2913@enea.se> <111@gannet.cl.cam.ac.uk>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!mcvax!enea!sommar From: sommar@enea.se (Erland Sommarskog) Newsgroups: comp.lang.misc Subject: Re: Iterators Message-ID: <2944@enea.se> Date: 30 Mar 88 07:58:16 GMT References: <1147@jenny.cl.cam.ac.uk> <2913@enea.se> <111@gannet.cl.cam.ac.uk> Reply-To: sommar@enea.UUCP(Erland Sommarskog) Followup-To: comp.lang.misc Organization: ENEA DATA AB, Sweden Lines: 24