On 02/06/2015 03:45 PM, John Cowan wrote:
> I'd also like close reviews of this SRFI, with particular regard to what
> procedures should be excluded or included. I feel like this proposal is
> groping in the dark.
I think formalizing the concept of generator makes a lot of sense.
However, I'm scared of adding yet another library with dozens of procedures.
I would rather we work to standardize some kind of loop library. For example,
I like the conceptual elegance of the old Common Lisp "series" library. In that
context one could define a 'scan-generator' or 'generator->series function to
the general loping API, and only need one or two new functions.
The Racket 'for' API has 'in-producer' to handle iterating over a generator.
(Would "producer" be a reasonable alternative name to "gnerator"?)
Generator as the conceptual base of a core looping API may be possible.
However, I have concerns about resource reclamation. For example if you do
(using Racket syntax):
(for ((x in-producer read-my-file)) ... x ...)
then the overflying my-file doesn't get closed automatically
So I think this API should go on the back-burner, and we should instead
focus on a looping API - keeping generators as part of the latter.
Something based on the Racket for/sequence API would probably work for me
- but then I already have a "sequence" type in Kawa.
--
--Per Bothner
xxxxxx@bothner.com http://per.bothner.com/