* bug#12758: letf no longer allows unbound variables
@ 2012-10-29 7:42 Glenn Morris
2012-10-29 13:46 ` Stefan Monnier
0 siblings, 1 reply; 2+ messages in thread
From: Glenn Morris @ 2012-10-29 7:42 UTC (permalink / raw
To: 12758
Package: emacs
Version: 24.2.50
In Emacs 24.2, this works:
emacs -Q -l cl
(letf ((b))
(setq b 99))
Evaluating this returns `99', and leaves `b' unbound. This behaviour is
documented in cl.texi:
In most cases, the @var{place} must have a well-defined value on
entry to the @code{letf} form. The only exceptions are plain
variables and calls to @code{symbol-value} and @code{symbol-function}.
If the symbol is not bound on entry, it is simply made unbound by
@code{makunbound} or @code{fmakunbound} on exit.
In current trunk, it throws an error:
Symbol's value as variable is void: b
cl-letf does no better than letf.
^ permalink raw reply [flat|nested] 2+ messages in thread
* bug#12758: letf no longer allows unbound variables
2012-10-29 7:42 bug#12758: letf no longer allows unbound variables Glenn Morris
@ 2012-10-29 13:46 ` Stefan Monnier
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2012-10-29 13:46 UTC (permalink / raw
To: Glenn Morris; +Cc: 12758
> Evaluating this returns `99', and leaves `b' unbound. This behaviour is
> documented in cl.texi:
> In most cases, the @var{place} must have a well-defined value on
> entry to the @code{letf} form. The only exceptions are plain
> variables and calls to @code{symbol-value} and @code{symbol-function}.
> If the symbol is not bound on entry, it is simply made unbound by
> @code{makunbound} or @code{fmakunbound} on exit.
I think this was a bad idea, so it indeed doesn't work that way any
longer; more specifically:
- W.r.t symbol-function, this is still true for `letf' but not for
`cl-letf'.
- W.r.t symbol-value, this is not true any more neither of `letf' nor or
`cl-letf' (I could change that for letf but in the absence of
a bug-report pointing to pre-existing code that depends on this
behavior I'd rather not).
- For (letf ((b 4)) ...) this is still true, because it expands to (let
((b 4)) ...). But for (letf ((b)) ...) it isn't because that expands
to (let ((b b)) ...).
When `b' is a lexically-scoped variable, we really can't "fix" it
because lexical variables don't have a notion of "unbound".
Stefan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-10-29 13:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-29 7:42 bug#12758: letf no longer allows unbound variables Glenn Morris
2012-10-29 13:46 ` Stefan Monnier
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.