emacs-devel
[Top][All Lists]
Advanced

[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 13:32:32 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

> I'd really rather signal to stop iteration. That way, it's harder to ignore
> end-of-iteration and loop forever and it remains possible to iterate over
> *any* value. condition-case is setjmp. I'm not *that* concerned by
> performance. The only other reasonable alternative is for iterators to
> yield a cons (terminal-p . value), and consing is going to be much worse
> than condition-case.

The alternative I was thinking was to return a unique value, as in:

   (defvar gen-eog (make-symbol "¡end-of-generator!"))
   (defun gen-eog-p (x) (eq x gen-oeg))

In terms of efficiency it should be fine (contrary to consing, indeed).


        Stefan



reply via email to

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