From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,399666c22a39304c X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: Translate this into Ada ... Date: 1996/08/29 Message-ID: #1/1 X-Deja-AN: 177191354 references: <3219E6E2.2F5@eurocontrol.fr> <4vfb15$ujr@watnews1.watson.ibm.com> organization: The World Public Access UNIX, Brookline, MA newsgroups: comp.lang.ada Date: 1996-08-29T00:00:00+00:00 List-Id: In article <4vfb15$ujr@watnews1.watson.ibm.com>, Norman H. Cohen 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