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: Daniel Colascione
Subject: Re: Generators (iterators) for Gnu Emacs
Date: Fri, 05 Dec 2014 17:08:26 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0

On 12/05/2014 01:32 PM, Stefan Monnier wrote:
>> 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))
> 

Right. That's the approach I don't like: now there's a value you can't 
enumerate. What if you wanted to enumerate, say, the values of all symbols?
        

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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