[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: need for 'dynamical-let'?
From: |
Stephen Leake |
Subject: |
Re: need for 'dynamical-let'? |
Date: |
Fri, 24 Jul 2015 02:58:09 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (windows-nt) |
"Stephen J. Turnbull" <address@hidden> writes:
> Stephen Leake writes:
>
> > Can we define a macro 'dynamical-let' that would implement this
> > pattern, but with hidden variables?
>
> First, was there a typo in your post? add-to-list normally takes a
> (quoted) symbol.
Yes, that's a typo
> `dynamical-let' is about as ugly as ugly can get, and anyway it
> shouldn't be necessary. The variable is lexically apparent and its
> value is not magical in any way. Your code *should* work.
add-to-list uses 'symbol-value' on the quoted symbol. As David Kastrup
points out, and as symbol-value doc string says, that does not see
lexical values. So the code will not work.
> Or, perhaps, as Dmitry and the add-to-list docstring suggest, you
> should convert the code to use `push' or `pushnew' instead.
I was working in Emacs 24.3, where the add-to-list doc string does not
mention "push". But the Emacs master doc string does mention it.
> The inconvenience of the busybody compiler macro may be considered a
> "feature" intended to encourage you to modernize your code.
Ok.
--
-- Stephe
Re: need for 'dynamical-let'?, Stefan Monnier, 2015/07/24