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: Thu, 19 Feb 2015 23:51:39 +0000

Stefan Monnier wrote:
>> To get rid of the ambiguity, I propose always using the term ‟void” for what
>> makunbound sets, and using the ‟bind/unbind” terminology exclusively for the
>> kind of binding that «let» does.
>
> Here's the problem: I don't see any difference between those two kinds
> of bindings and the implementation doesn't see them as different either.

The implementation does see them as different, and the difference is exposed to 
the Lisp world too. The difference is not dependent on the interpretation of 
whether «let» creates a new variable or temporarily changes the value of the 
global variable.

The difference is because makunbound works for let-bound and buffer-local 
variables. Regardless of the interpretation, there are two different kinds of 
‟unbind” events: the one caused by exit of a «let» (which unshadows/restores 
the outer/previous value), and the one caused by makunbound (which sets the 
value to void). These are different in the implementation and different in the 
Lisp world (observable by doing makunbound on a let-bound or buffer-local 
variable, then exiting the «let» or killing the buffer-local), yet the same 
terminology is used for both.

I'm proposing a difference in terminology to account for those two different 
kinds of events.

In contrast, if makunbound didn't work for let-bound or buffer-local variables, 
then there wouldn't be two different kinds of events in the Lisp world (though 
there would still be in the implementation), because setting 
non-shadowing/not-temporarily-changed non-buffer-local variables to void is 
indistinguishable from unbinding them in the let-binding sense (because there's 
no shadowed/previous value to restore). And because there would be only one 
kind of event, there would be no need for a difference in terminology to avoid 
ambiguity.

>> Just to be clear, the only reason there's any ambiguity in the first place
>> is because makunbound operates on non-global variables.
>
> Dynamically-scoped vars are global.

In my message, I wrote that by ‟non-global” I meant ‟let-bound or 
buffer-local”, so I could use ‟non-global” and ‟global” as shorthand in the 
rest of the message. For your preferred interpretation of what let-binding 
does, just pretend I spelled out ‟let-bound-or-buffer-local” and 
‟not-let-bound-and-not-buffer-local”.



reply via email to

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