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 19:30:25 -0400 (EDT)

+ Lennart Borgman <address@hidden>:

> On Wed, Aug 12, 2009 at 12:51 AM, Miles Bader<address@hidden> wrote:
> > I haven't looked at the code (recently), but because elisp doesn't
> > natively support lexical blocks, I suspect the cl-macs version either
> > (1) adds unnecessary runtime overhead, or (2) drags in lots of big and
> > crufty compile-time analysis code (cl.el has lots of this) to optimize
> > away the block when not used.

Actually, the cl-macs version looks pretty simple to me.

> Maybe the CL version should go away instead? It creates a lexically
> scoped block with a name nil. The explanation in (defmacro block ...)
> does however not say what is lexically scoped so I have no clue.

AFAICT, the only thing lexically scoped is the name of the block.
In other words, (return-from NAME) will return from the innermost
block named NAME that lexically contains the return-from form. I think
this is pretty well explained in the block docstring?

> (And I do not know if return-from mentioned there can work with a
> nil name.)

(return-from nil) is perfectly good CL, so it ought to work.

> However if if means that one dolist version makes VAR lexically scoped
> and the other does not, then the difference is big.

But it doesn't mean that, as a simple experiment bears out. I think
the only difference between the two is the block, and that will not
affect any elisp code that is unaware of block and return-from.

- Harald




reply via email to

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