[Openmcl-devel] How abour top-level setf = REPL-lexical variables? (was Re: Compiler warnings)
ron at flownet.com
Tue Oct 20 06:02:50 UTC 2009
On Oct 19, 2009, at 7:00 PM, Kevin Reid wrote:
> On Oct 19, 2009, at 21:34, Ron Garret wrote:
> [in a long thread about the behavior of top-level setf]
>> Yes. I'm doing some testing, so I want some place to stash an
>> intermediate result. I do:
>> (setf x ...)
>> Later, after I'm long done with that and the fact that I once created
>> a global variable named X, I do this:
>> (defun make-closure (x) (lambda () ... x ...))
>> I then expect MAKE-CLOSURE to return a lexical closure.
> IMO, the best way to make this DWIM (which as far as I know is
> conformant (in that the REPL is mostly unspecified) but not currently
> done by any CL implementation) is to make x a *lexical* variable which
> is managed by the REPL. Your example would then do exactly what you
I think some people would still be surprised by the following:
(setf x 1)
(eval 'x) -> ERROR
Also, what should the following do:
(set 'x 1)
(setf x 2)
x -> ???
> I think this facility would have the following benefits:
> - Saves typing when playing around at the REPL, since there's no
> for *special* markers.
> - Reminds you what you created as an interactive temporary vs. what
> global state of the application, both syntactically and because
> can get a list of them.
> - Fits what a lot of beginners expect, because they're
> - coming from Perl/Python/PHP/whatever
> - using ancient tutorials/samples with top-level setq/setf
> (This isn't just a beginner thing -- *I* would greatly like to
> this feature to save me inventing special-variable names while
> And it's AFAIK fully conformant with CLHS.
You might want to take a look at:
More information about the Openmcl-devel