emacs-devel
[Top][All Lists]
Advanced

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

Re: Why is there no `until' in elisp?


From: Garreau\, Alexandre
Subject: Re: Why is there no `until' in elisp?
Date: Fri, 19 Oct 2018 20:08:07 +0200
User-agent: Gnus (5.13), GNU Emacs 25.1.1 (i686-pc-linux-gnu)

On 2018-10-19 at 11:34, Stefan Monnier wrote:
>> think `until' should refer to the version I gave because this is
>> probably the one which is going to be implemented naively by most
>> people,
>
> BTW, this is only true if those people have to implement it on top of
> the pre-existing `while`.  Once you go down to implementing it as
> a sequence of byte-codes, then the `until` you proposed is no simpler
> than the one I proposed.
>
> So reversing your argument, if Elisp had my `until` and you wanted to
> define `while` would you define it to return nil or to return t?
> IOW would you define it as
>
>     (defmacro while (test &rest body)
>       `(until (not ,test) ,@body))
> or
>     (defmacro while (test &rest body)
>       `(progn (until (not ,test) ,@body) nil))
>
> ?

The former, you’re right.  What I was saying was mainly to keep
consistence, only then I was finding that, for me, returning the body of
a loop looks more logical than returning its condition (as you said,
this only makes sense for until).  But now I saw the working of `while'
match the semantics you gave, I believe your version is better to be
implemented, in elisp.



reply via email to

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