[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: defvar inside let-binding
From: |
Lars Magne Ingebrigtsen |
Subject: |
Re: defvar inside let-binding |
Date: |
Mon, 18 Jul 2011 16:20:19 +0200 |
User-agent: |
Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux) |
Stefan Monnier <address@hidden> writes:
>> Has changing the way `defvar' works in the presence of let-bindings been
>> discussed?
>
> No. Personally I can't see how to make it work, because by the time we
> get to defvar it's kind of too late. Maybe we could try to change the
> let-binding so that the "saved void state" (which will be restored at
> the end of the outer let) gets changed as if the var had been defvarred
> before the let-binding. But it sounds terribly hackish.
That was exactly what I was thinking should happen. :-)
I mean, if you say
(let ((foo-var nil))
(foo-function))
and `foo-function' is autoloaded -- I can't think of a single use case
where you'd want `foo-var' to be unbound afterwards.
That `foo-function' is autoloaded or a real function is something that
should (in my opinion) have no effect on what you'd end up with after
calling it.
Leaving `foo-var' unbound is what is the hack, I think. We should
strive to end up with the same result after calling `foo-function', no
matter whether it's autoloaded or not.
> Of course, another problem is that in the case of defcustom we don't
> even detect the problem.
I'm not sure I follow you there...
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog http://lars.ingebrigtsen.no/