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 10:45:17 +0000

> The word "unbound" is being used in an ambiguous fashion, but once you
> see past that, there is nothing strange about what's really going on.
>
> Maybe we should change terminology to get rid of the ambiguity.
> The name 'makunbound' is the cause of it, but that is hard to change now.
> We could at least explain it better.

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.

Emacs already uses the term ‟void” sometimes. For example, if you try to 
evaluate a symbol after doing makunbound on it, then assuming there isn't a 
lexical variable of it in scope, it signals the error ⌜void-variable⌝. And the 
docstrings for makunbound and boundp use that term. Consistently using it would 
make the code more clear.

So, I propose a global search/replace in the source code of ⌜Qunbound⌝ to 
⌜Qvoid⌝. Maybe you'll think that in some places, it really makes more sense to 
interpret it as «unbound», not «void». However, that would be inconsistent, if 
makunbound is allowed to function on non-global (i.e. let-bound or 
buffer-local) variables. To make it consistent, leave ⌜Qunbound⌝ the way it is, 
and make makunbound stop functioning on non-global variables; that's what I 
prefer, but since nobody else does, the alternative way of being consistent is 
to change ⌜Qunbound⌝ to ⌜Qvoid⌝.

A search-replace of ⌜unbound⌝ to ⌜void⌝ in the «el» files would also be in 
order, but it would break code that depends on the current names, and 
apparently just making aliases for the old names isn't an acceptable solution. 
Currently, the Elisp code is inconsistent; it uses ‟void” in a few places, and 
‟unbound” in most others. It doesn't look like it ever uses ‟unbound” in the 
sense of let-binding. In the manual, it's the opposite: it usually uses ‟void” 
for the special value, and uses ‟unbound” in the sense of let-binding in a 
couple places.

Just to be clear, the only reason there's any ambiguity in the first place is 
because makunbound operates on non-global variables. If it didn't do that, 
there would be no need for «void» as a separate concept. (Being bound to void 
vs. being unbound is indistinguishable for globals, since they can't shadow 
anything.) ‟Unbound” would be all that's needed, ‟void” would just be a 
synonym, and the names of makunbound and boundp would be appropriate for those 
functions.



reply via email to

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