[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: The purpose of makunbound
From: |
Stefan Monnier |
Subject: |
Re: The purpose of makunbound |
Date: |
Wed, 18 Feb 2015 17:42:41 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
>> Why would that be an error?
> Because of a classic mistake with dynamic binding:
> (defvar bar nil)
> (defun foo ()
> (if something-rare...
> (makunbound 'bar)) ; Intent is global
> (do-something))
> (let ((bar (something))) ; Intent is lexical
> (do-some-stuff)
> (foo)
> (if bar ; Oops
> (some-other-stuff)))
This problematic situation is problematic regardless of the presence of
makunbound. You simply can't have a (defvar <foo> <val>) for a variable
you need to use lexically elsewhere.
> For single-threaded code, there's no difference, but for multi-threaded,
> there is, which you already mentioned. Why have inconsistent interpretations
> for single vs. multi, when you can have a consistent one for both?
Note that the current implementation technique for "bound/unbound" still
works just fine with multithreading (the implementation of dynamically
scoped "let" is more problematic but it has no particular problematic
interaction with makunbound).
So, adding multi-threading won't make much difference to this "problem".
Stefan
- Re: [PATCH] (Updated) Run hook when variable is set, (continued)
- Re: [PATCH] (Updated) Run hook when variable is set, Stefan Monnier, 2015/02/13
- Re: [PATCH] (Updated) Run hook when variable is set, Kelly Dean, 2015/02/14
- Re: [PATCH] (Updated) Run hook when variable is set, Stefan Monnier, 2015/02/15
- [PATCH] (Updated) Run hook when variable is set, Kelly Dean, 2015/02/16
- Re: [PATCH] (Updated) Run hook when variable is set, Richard Stallman, 2015/02/17
- The purpose of makunbound (Was: Run hook when variable is set), Kelly Dean, 2015/02/17
- Re: The purpose of makunbound, Stefan Monnier, 2015/02/18
- Re: The purpose of makunbound, Kelly Dean, 2015/02/18
- Re: The purpose of makunbound, Stefan Monnier, 2015/02/18
- Re: The purpose of makunbound, Kelly Dean, 2015/02/18
- Re: The purpose of makunbound,
Stefan Monnier <=
- Re: The purpose of makunbound, Kelly Dean, 2015/02/19
- Re: The purpose of makunbound, Kelly Dean, 2015/02/21
- Re: The purpose of makunbound, Kelly Dean, 2015/02/19
- Re: The purpose of makunbound, Stefan Monnier, 2015/02/19
- Re: The purpose of makunbound, Kelly Dean, 2015/02/19
- Re: The purpose of makunbound, Stefan Monnier, 2015/02/19
- Re: The purpose of makunbound, Kelly Dean, 2015/02/20
- Re: The purpose of makunbound, Stefan Monnier, 2015/02/20
- Re: The purpose of makunbound, Stephen J. Turnbull, 2015/02/19
- Re: The purpose of makunbound, Richard Stallman, 2015/02/19