help-gnu-emacs
[Top][All Lists]
Advanced

[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: Tue, 19 Apr 2005 23:45:01 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

"rgb" <rbielaws@i1.net> writes:

> Now that I've slept, maybe I'll understand.  Can we try again
>
> Stefan Monnier wrote:
>> > If symbols created by let refer to an abstract concept then you're
>>
>> `let' does not create symbols.
>
> Ok, semantic error.  From the point of view of a program the
> symbol is being created and destroyed but actually it must
> just be getting interned and uninterned.

Uh, no.

> I don't know of a way to tell the difference but I can't think of a
> reason I'd need to know other than to use the correct term here.
>
> So if I conceed it isn't being `created' and you replace my
> erroneous use of create with intern does it make any difference?
> If not, what explains this?
>
> (defun test ()
>   (let (foo)
>     (put 'foo 'hold "this ")
>     (symbol-plist 'foo)))
> => test
>
> (unintern "foo")
> => t
>
> (symbol-plist 'foo)
> => nil
>
> (test)
> => (hold "this ")
>
> (symbol-plist 'foo)
> => nil
>
> The lifetime of the plist is obviously limited.

Nonsense.  How would you explain this then:

(defun test ()
  (let (foo)
     (put 'foo 'hold "this ")
     (setq woozle 'foo)
     (symbol-plist 'foo)))
=> test

(unintern "foo")
=> t

(symbol-plist 'foo)
=> nil
(test)
=> (hold "this ")
(symbol-plist 'foo)
=> nil
(symbol-plist woozle)
=> (hold "this ")

The symbol is obviously still there.  It only is no longer associated
with the same name.  But as long as you took a snapshot of the symbol
before it became anonymous (that's what woozle does), you can still
refer to that snapshot, even though the symbol itself has no longer an
accessible name.  It does have a print name, though:

woozle
=> foo

Note that woozle is no longer the same as 'foo, since the association
of the symbol stored in woozle with the default obarray does no longer
exist.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum


reply via email to

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