comp.lang.ada
 help / color / mirror / Atom feed
From: fjh@cs.mu.oz.au (Fergus Henderson)
Subject: Re: Ultimate Language feature list
Date: 1998/05/15
Date: 1998-05-15T00:00:00+00:00	[thread overview]
Message-ID: <6jgivo$p18$1@mulga.cs.mu.OZ.AU> (raw)
In-Reply-To: 6jcjqq$jl4$1@nnrp1.dejanews.com


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 <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh@128.250.37.3        |     -- the last words of T. S. Garp.




  parent reply	other threads:[~1998-05-15  0:00 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-05-13  0:00 Ultimate Language feature list adam
1998-05-14  0:00 ` Rainer Joswig
1998-05-14  0:00   ` John English
1998-05-14  0:00     ` Michael F Brenner
1998-05-14  0:00       ` John McCabe
1998-05-14  0:00       ` Charles Hixson
1998-05-15  0:00 ` Fergus Henderson [this message]
  -- strict thread matches above, loose matches on Subject: below --
1998-05-13  0:00 MSG
1998-05-13  0:00 ` Mark K. Gardner
1998-05-15  0:00   ` Jussi Santti
1998-05-13  0:00 ` Charles Hixson
1998-05-14  0:00   ` Eugene Mayevski
1998-05-13  0:00 ` John McCabe
1998-05-14  0:00 ` Mats Weber
1998-05-15  0:00 ` Nick Leaton
1998-05-15  0:00 ` Nick Roberts
1998-05-16  0:00   ` Tarjei T. Jensen
1998-05-15  0:00 ` Fergus Henderson
1998-05-15  0:00 ` Chris Miller
1998-05-15  0:00   ` Franck Arnaud
1998-05-15  0:00   ` Stephen Bull
1998-05-20  0:00     ` John Volan
replies disabled

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