in a elisp program, if i have created a temp var (but not using let) and later i want to delete the var, i can do:
(setq temp1 nil)
or is it better to do
(unintern 'temp1)
The temp1 var holds a big list, and there are few more, e.g. temp2, temp3.
-----------------------------
Mathematica is similar to lisp in the symbol system. In Mathematica, lisp's “unintern” is “Remove”. From my know-how, basically you don't Remove a symbol. You just Clear it (set it to nil).
----------------------------- if i use “let”, that means few hundred lines inside it with other lets. Not desirable.
> in a elisp program, if i have created a temp var (but not using let) > and later i want to delete the var, i can do:
> (setq temp1 nil)
> or is it better to do
> (unintern 'temp1)
> The temp1 var holds a big list, and there are few more, e.g. temp2, > temp3.
> -----------------------------
> Mathematica is similar to lisp in the symbol system. In Mathematica, > lisp's “unintern” is “Remove”. From my know-how, basically you don't > Remove a symbol. You just Clear it (set it to nil).
> ----------------------------- > if i use “let”, that means few hundred lines inside it with other > lets. Not desirable.
> How do you solve this problem?
> Thanks.
> Xah
you cannot delete a symbol. the garbage collection deletes objects automatically when not referenced anymore. but since the symbol templ is referenced by your program it cannot be deleted.
uninterning doesn't do the job either because it just causes the reader not to recognize your symbol templ anymore. when you enter an expression containing templ after uninterning it the reader will create a new symbol different from your old symbol templ that just happens to have the same name.
you also don't need to unbind templ. unbinding is done automatically once the binding form is left.
what you actually want to do is to return templ into the state it had when your program started. this is done by (setq templ nil).
Konfusius <wenhamm...@plus.cablesurf.de> writes: > On 10 Jun., 00:36, Xah Lee <xah...@gmail.com> wrote: >> in a elisp program, if i have created a temp var (but not using let) >> and later i want to delete the var, i can do:
>> (setq temp1 nil)
>> or is it better to do
>> (unintern 'temp1)
>> The temp1 var holds a big list, and there are few more, e.g. temp2, >> temp3.
>> -----------------------------
>> Mathematica is similar to lisp in the symbol system. In Mathematica, >> lisp's “unintern” is “Remove”. From my know-how, basically you don't >> Remove a symbol. You just Clear it (set it to nil).
>> ----------------------------- >> if i use “let”, that means few hundred lines inside it with other >> lets. Not desirable.
>> How do you solve this problem?
>> Thanks.
>> Xah
> you cannot delete a symbol. the garbage collection deletes objects > automatically when not referenced anymore. but since the symbol templ > is referenced by your program it cannot be deleted.
> uninterning doesn't do the job either because it just causes the > reader not to recognize your symbol templ anymore. when you enter an > expression containing templ after uninterning it the reader will > create a new symbol different from your old symbol templ that just > happens to have the same name.
> you also don't need to unbind templ. unbinding is done automatically > once the binding form is left.
> what you actually want to do is to return templ into the state it had > when your program started. this is done by (setq templ nil).
You shouldn't have given those explanations to Xah, now he will write yet another article about the idiocy of lisp hackers who designed such a system...
> Not at all. (Yet some other fodder for Xah's idiocy articles, sorry).
you mean my articles describing idiots like you?
Here's a juicy passage of Pascal J Bourguignon fellow, in which you can get a glimpse of his highness:
«Ruby's been done by some Japanese newbie... I guess there was some language barrier preventing him to learn from the 50 years of occidental experience in programming language design. At least, he wasn't a "linguist"... In any case, why should we suffer for THEIR incompetences?!?»
> On 10 Jun., 00:36, Xah Lee <xah...@gmail.com> wrote:
> > in a elisp program, if i have created a temp var (but not using let) > > and later i want to delete the var, i can do:
> > (setq temp1 nil)
> > or is it better to do
> > (unintern 'temp1)
> > The temp1 var holds a big list, and there are few more, e.g. temp2, > > temp3.
> > -----------------------------
> > Mathematica is similar to lisp in the symbol system. In Mathematica, > > lisp's “unintern” is “Remove”. From my know-how, basically you don't > > Remove a symbol. You just Clear it (set it to nil).
> > ----------------------------- > > if i use “let”, that means few hundred lines inside it with other > > lets. Not desirable.
> > How do you solve this problem?
> > Thanks.
> > Xah
> you cannot delete a symbol. the garbage collection deletes objects > automatically when not referenced anymore. but since the symbol templ > is referenced by your program it cannot be deleted.
> uninterning doesn't do the job either because it just causes the > reader not to recognize your symbol templ anymore. when you enter an > expression containing templ after uninterning it the reader will > create a new symbol different from your old symbol templ that just > happens to have the same name.
> you also don't need to unbind templ. unbinding is done automatically > once the binding form is left.
> what you actually want to do is to return templ into the state it had > when your program started. this is done by (setq templ nil).