From: adam@irvine.com
Subject: Re: Ultimate Language feature list
Date: 1998/05/13
Date: 1998-05-13T00:00:00+00:00 [thread overview]
Message-ID: <6jcjqq$jl4$1@nnrp1.dejanews.com> (raw)
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;
and the caller would have primitives available to test for the end of
the sequence, get the next element of the sequence, etc.; or you'd
have constructs like:
for Int in Nonzero_Elements_Of (My_List) loop
...
end loop;
which would set Int in turn to each element returned by the function;
or you'd have ways to deal with the whole sequence, e.g. you could
pass the function result of Nonzero_Elements_Of as an "in" parameter
to another procedure that declares a "sequence of Integer" as a
parameter. Etc. Of course, there would be no requirement that a
sequence be finite.
Well, I can dream. Naturally, this dream has come up again since I'm
involved in another discussion involving how to implement an iterator.
-- Adam
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
next reply other threads:[~1998-05-13 0:00 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-05-13 0:00 adam [this message]
1998-05-14 0:00 ` Ultimate Language feature list Rainer Joswig
1998-05-14 0:00 ` John English
1998-05-14 0:00 ` Michael F Brenner
1998-05-14 0:00 ` Charles Hixson
1998-05-14 0:00 ` John McCabe
1998-05-15 0:00 ` Fergus Henderson
-- 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 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
1998-05-15 0:00 ` Nick Leaton
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox