emacs-devel
[Top][All Lists]
Advanced

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

Re: Why are there two dolist?


From: Harald Hanche-Olsen
Subject: Re: Why are there two dolist?
Date: Tue, 11 Aug 2009 20:27:30 -0400 (EDT)

+ 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.

- Harald




reply via email to

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