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: fac41,ea30c4e9c3d00b X-Google-Attributes: gidfac41,public X-Google-Thread: f79bb,1ba669bff6ce01ff X-Google-Attributes: gidf79bb,public X-Google-Thread: 103376,ea30c4e9c3d00b X-Google-Attributes: gid103376,public From: fjh@cs.mu.oz.au (Fergus Henderson) Subject: Re: Ultimate Language feature list Date: 1998/05/15 Message-ID: <6jgivo$p18$1@mulga.cs.mu.OZ.AU>#1/1 X-Deja-AN: 353421475 References: <6jcjqq$jl4$1@nnrp1.dejanews.com> Organization: Computer Science, The University of Melbourne Newsgroups: comp.lang.ada,comp.lang.eiffel,comp.lang.sather Date: 1998-05-15T00:00:00+00:00 List-Id: In comp.lang.ada and comp.lang.eiffel, adam@irvine.com writes: >Well, as long as we're talking about what language features we want, >here's one I've always wanted: The ability to deal with sequences of >objects. I don't mean a list of objects where you have to create an >array or linked list in memory that contains all the objects; I mean >the ability to write code that talks about sequences of objects even >though the program only generates one at a time. So I'd like to be >able to write a function like this: > > -- Integer_List is a "traditional" linked list of integers > function Nonzero_Elements_Of (List : Integer_List) > return sequence of Integer is > begin > List_P := List; > while List_P /= null loop > if List_P.Data /= 0 then > return List_P.Data; > -- Note: this RETURN would return one integer but > -- would NOT terminate the function; eventually the > -- caller would return to this point in the function > -- to get more > end if; > List_P := List_P.Next; > end loop; > end; I think you just reinvented Sather's `iterator' language construct. Of course, some of the syntactic details are different, e.g. if I recall correctly, this sort of iterator `return' is spelt `yield' in Sather. But the basic concept is pretty much the same. >Well, I can dream. You can do better than dream -- the Sather compiler is freely available, so you can download it and try it out! ;-) -- Fergus Henderson | "I have always known that the pursuit WWW: | of excellence is a lethal habit" PGP: finger fjh@128.250.37.3 | -- the last words of T. S. Garp.