[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Generators (iterators) for Gnu Emacs

From: Stefan Monnier
Subject: Re: Generators (iterators) for Gnu Emacs
Date: Fri, 05 Dec 2014 23:09:07 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

> Assuming both packages are suitable for inclusion into core, we can
> definitely make them work together.

That's the idea, yes.

> I'd still very much like to use nonlocal control flow instead of
> a sentinel for enumeration termination, however.

I'll let you guys decide together.  I stated my preference, but I have
better things to worry about.

> That aside, I'm not sure I agree with your namespace preferences. `yield' is
> fundamentally a lexically-scoped macro.

The lexically scoped `yield' is OK.  But the global (defmacro yield ...)
is not (tho, I'm OK with keeping it if wrapped in (unless (fboundp
'yield) ...)).

> I'd also strongly prefer using `next' as the iter-get function.

I know, but this one is out of the question.  All globally-visible names
need to be namespace-clean.  So it can be `gen-next'.

> I'd also prefer using `iterating' as the cl-loop keyword.

I know, but being globally visible, this is also out of the question: it
requires something with a "gen-" or at least some "generator" in its
name somewhere.

> Because the keyword is only active in the lexical scope of a cl-loop
> construct, there's an even lower risk of collision, and the word
> "iterating" is exactly the right thing in the cl-loop language:
> (cl-loop for x iterating y collect x) reads very well.

But it doesn't say we're iterating on your particular kind of iteratable
[ BTW: regardless of namespace cleanliness, I don't find "iterating"
  above to be a good choice, because "x" doesn't "iterate y".
  The "cl-loop" doesn't do anything else than iterate, so "iterating" is
  almost necessarily a misnomer in there.  From an English language
  point of view, I'd expect something more like "for x generated-by y"
  or "for x in-generator y" or "for x in y".  ]


reply via email to

[Prev in Thread] Current Thread [Next in Thread]