[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
need for 'dynamical-let'?
From: |
Stephen J. Turnbull |
Subject: |
need for 'dynamical-let'? |
Date: |
Fri, 24 Jul 2015 13:23:34 +0900 |
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. Since the argument isn't quoted, it appears that the
effect is that you are attempting to add-to-list to the variable (not
the value!) nil. Assuming that was 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.
Try running your code in the interpreter. I suspect it will work when
the function is actually called (in compiled code there's a compiler
macro so the function is never called). Why not fix that instead?
Or, perhaps, as Dmitry and the add-to-list docstring suggest, you
should convert the code to use `push' or `pushnew' instead. The
inconvenience of the busybody compiler macro may be considered a
"feature" intended to encourage you to modernize your code.
Re: need for 'dynamical-let'?, Stefan Monnier, 2015/07/24