[Top][All Lists]

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

Re: Why are there two dolist?

From: Lennart Borgman
Subject: Re: Why are there two dolist?
Date: Wed, 12 Aug 2009 02:33:23 +0200

On Wed, Aug 12, 2009 at 2:27 AM, Harald Hanche-Olsen<address@hidden> wrote:
> + Lennart Borgman <address@hidden>:
>> Thanks, but I do not understand all you wrote here. Could (return-from
>> NAME) be inside a function in dolist or does it have to be just inside
>> dolist so to say?
> Hmm. I was writing some code to demonstrate my point, but found to my
> surprise that the following snippet
> (block nil
>  (flet ((foo (x) (if (eq x 'b)
>                      (return-from nil 'foo-done))))
>    (list 'from-dolist
>          (dolist (var '(a b c) 'dolist-done)
>            (foo var)))))
> which returns foo-done in a proper CL, returns (from-dolist foo-done)
> in elisp with the cl package loaded. This seems wrong.
> In CL, flet declares a lexically local function binding. Since the
> declaration of foo here is lexically outside the dolist, the
> return-from inside the body of foo should not see the implicit block
> named nil in the dolist, and that is what happens in CL. In elisp,
> however, that does not work as I expected. I'm confused.

I do not understand your code above, but is not the conclusion that
the cl-macs.el version does not do what it is supposed to do? What
value does it have then? (Perhaps it can be fixed, I don't know.)

reply via email to

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