GNU bug report logs -
#5371
Priority of different kind of local variable bindings
Previous Next
Full log
Message #17 received at 5371 <at> debbugs.gnu.org (full text, mbox):
On Wed, Jan 13, 2010 at 7:45 PM, Stefan Monnier
<monnier <at> iro.umontreal.ca> wrote:
>>> What do you mean by "priority of different kind of local variables"?
>> I just meant which value is active at a certain point.
>
> It's not based on priorities.
>
>> (with-temp-buffer
>> (set (make-local-variable 'temp-var) "buffer-2")
>> (temp-var-display "cc")
>
>> (let ((temp-var "let"))
>> (temp-var-display "dd")
>
>> (kill-local-variable 'temp-var)
>> (temp-var-display "ff"))
>
> The `let' binding affects the currently "active" slot, so in this case
> it affects the buffer-local slot. So after kill-local-variable, this
> binding is lost.
Ok, I see.
> Note that mixing let-binding and buffer-local bindings is generally
> discouraged. The only known reasonably sane semantics for such a mix is
> when the variable is always buffer-local. If you mix `let' with
> make-local-variable and kill-local-variable you're really asking
> for trouble.
I know ;-)
Is this explained somewhere (except for the code)?
This bug report was last modified 15 years and 209 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.