emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: The purpose of makunbound


From: Kelly Dean
Subject: Re: The purpose of makunbound
Date: Fri, 20 Feb 2015 09:35:30 +0000

Stefan Monnier wrote:
> Ah, I think I understand a bit better.  I think treating "void" as an
> event is the error: it's a state.  OTOH, the "revert to previous
> state" done at the end of `let' is indeed an event.

I'm not treating void as an event. Of course it's a state. I'm treating «set 
the state to void» as an event, and «exit let» as an event, and my first point 
is that since they're different events with different resultant states, 
different terminology should be used for them.

My second point is that if makunbound didn't work for let-bound or buffer-local 
variables, then the void state could never shadow a non-void state, which means 
an «exit let» event could never change a void state to a non-void state. 
Therefore a «set the state to void» event would be indistinguishable from an 
«exit let» event in which no non-void state had been shadowed, and of course 
there's no need for different terminology for indistinguishable events. In 
contrast, with makunbound's current behavior, those two events are 
distinguishable: the first one leaves open the possibility that a subsequent 
«exit let» event will produce a non-void state, but the second one doesn't.

> I don't see "unbind" used anywhere in the description of what `let'
> does, nor is it a term that I've heard used (other than by yourself) to
> refer to what happens at the end of a "let".

The definition of «let» in eval.c calls the function «unbind_to» at the end.

Also see the Emacs 24.4 Elisp manual:
(elisp) Catch and Throw (section 10.5.1):
⌜Executing `throw' exits all Lisp constructs up to the matching
`catch', including function calls.  When binding constructs such as
`let' or function calls are exited in this way, the bindings are
unbound, just as they are when these constructs exit normally⌝

(elisp) Named Features (section 15.7):
⌜Loading a library while its variables are let-bound can have
unintended consequences, namely the variables becoming unbound after
the let exits.⌝

(elisp) Warning Variables (section 37.5.2):
⌜Programs can bind this variable to `t' to say that the next
warning should begin a series.
...
The series ends when the local binding
is unbound and `warning-series' becomes `nil' again.⌝

(elisp) Intro to Buffer-Local (section 11.10.1):
⌜if you exit the `let'
while still in the other buffer, you won't see the unbinding occur⌝



reply via email to

[Prev in Thread] Current Thread [Next in Thread]