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

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

Re: unintern a symbol vs set to nil


From: Pascal J. Bourguignon
Subject: Re: unintern a symbol vs set to nil
Date: Wed, 28 Mar 2012 19:17:07 -0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Alan Mackenzie <acm@muc.de> writes:

> Hi, Xah.
>
> Xah Lee <xahlee@gmail.com> wrote:
>> in a elisp program, if i have created a temp var (but not using let)
> ....
>
> As a matter of interest, how do you do that?
>
>> .... and later i want to delete the var, i can do:
>
>> (setq temp1 nil)
>
>> or is it better to do
>
>> (unintern 'temp1)
>
> Shouldn't much matter.  Probably better to set it to nil, because that's
> more usual.  OTOH, if you want to detect an error should temp1 be
> subsequently accessed, then uninterning it will be better.

Not at all.  (Yet some other fodder for Xah's idiocy articles, sorry).

    (defvar temp1 42)

    (defun f ()
      temp1)

    (unintern 'temp1)

    (f) --> 42





>> The temp1 var holds a big list, and there are few more, e.g. temp2,
>> temp3.
>
> Either approach will allow these lists to be garbage collected.

Wrong.  See above.


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.


reply via email to

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