[Top][All Lists]

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

Re: Mis-features of let

From: David Kastrup
Subject: Re: Mis-features of let
Date: Wed, 20 Apr 2005 12:04:17 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

"rgb" <address@hidden> writes:

>> > and use of functions such as fset and put have undefined results
>> > (which I showed in my examples).
>> No, you didn't.  You uninterned the symbol, after which it was no
>> longer available under the name 'foo.
>> But if you had done (setq woozle 'foo) before uninterning it,
>> woozle would have continued to be a perfectly valid handle to the
>> symbol, even though 'foo no longer was able to access it.
> After all the coding I've done I had no idea my understanding of
> what was going on was so fundamentally flawed.  It's easy to
> pinpoint just where this missunderstanding stems from though.
> Elisp reference:
> 8. Symbols
>   A symbol is an object with a unique name.

Well, that's stressing it.  Obviously there can be multiple symbols
with the same print name, and symbols are not required to actually
have an obarray name, whether in the default obarray or elsewhere.

You can't change the various names of a symbol once it has been
created (in particular not the print name), but you can detach the
symbol from its associated obarray, if any.

> 8.3 Creating and Interning Symbols
>   To understand how symbols are created in GNU Emacs Lisp, you must
>   know how Lisp reads them.  Lisp must ensure that it finds the same
>   symbol every time it reads the same set of characters.  Failure to
>   do so would cause complete confusion.
> I was under the impression that let must be creating a symbol with
> the name I specified if one didn't already exist.

Oh, but it does.  It is creating a symbol with the unique name IN
OBARRAY if it did not already exist.  After uninterning it, none with
that name exists IN OBARRAY.

> Many tests seemed to confirm this view but some did not, triggering
> this dialog.
> What you appear to be saying is that
> 1. symbols do not have unique names they have unique handles.

You can't change the name of a symbol, and a symbol is interned at
most in one obarray, but it can be uninterned.  It will still print
the same, though, but it will no longer be accessible by that name.

> 2. the lisp reader won't necessarily find the same symbol every
> time.  It will find whatever symbol is interned in the global
> obarray with a name equal to the name being read at the time.


> So, although it almost always is the same, nothing actually ensures
> it is the same.
> Hopefully there are no more such flaws in my understanding.

Looks more or less straight.  Note that there is not much freedom with
symbol names.  The name you choose stays with it from the start, but
you can pick an initial obarray (if you use "intern") or not (if you
create the symbol using "make-symbol").  In either case, names can't
be changed, and the only remaining operation is uninterning it.  This
does not destroy the symbol: it still prints the same, and as long as
references to it exist, it won't get garbage-collected.

David Kastrup, Kriemhildstr. 15, 44793 Bochum

reply via email to

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