From: Harald Hanche-Olsen <hanche@math.ntnu.no>
To: emacs-devel@gnu.org
Subject: Re: Why are there two dolist?
Date: Tue, 11 Aug 2009 20:27:30 -0400 (EDT) [thread overview]
Message-ID: <20090811.202730.45673955.hanche@math.ntnu.no> (raw)
In-Reply-To: <e01d8a50908111639k5db14c76w53d2122dcdbe3f8f@mail.gmail.com>
+ Lennart Borgman <lennart.borgman@gmail.com>:
> 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
next prev parent reply other threads:[~2009-08-12 0:27 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-11 22:14 Why are there two dolist? Lennart Borgman
2009-08-11 22:36 ` Lennart Borgman
2009-08-12 8:45 ` David Kastrup
2009-08-12 8:52 ` Lennart Borgman
2009-08-11 22:37 ` Miles Bader
2009-08-11 22:42 ` Lennart Borgman
2009-08-11 22:51 ` Miles Bader
2009-08-11 23:04 ` Lennart Borgman
2009-08-11 23:30 ` Harald Hanche-Olsen
2009-08-11 23:34 ` Miles Bader
2009-08-11 23:41 ` Lennart Borgman
2009-08-11 23:48 ` Miles Bader
2009-08-11 23:39 ` Lennart Borgman
2009-08-12 0:27 ` Harald Hanche-Olsen [this message]
2009-08-12 0:33 ` Lennart Borgman
2009-08-12 0:54 ` Miles Bader
2009-08-12 0:59 ` Lennart Borgman
2009-08-12 1:24 ` Harald Hanche-Olsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090811.202730.45673955.hanche@math.ntnu.no \
--to=hanche@math.ntnu.no \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.