newLISP Fan Club

Forum => newLISP in the real world => Topic started by: itistoday on October 26, 2009, 04:59:29 PM

Title: Bug? 'delete' doesn't work on constants
Post by: itistoday on October 26, 2009, 04:59:29 PM
> (constant 'foo 3)
3
> (delete 'foo)
nil
> (set 'foo 3)

ERR: symbol is protected in function set : foo


Is this a bug or is there a reason for this?
Title: Re: Bug? 'delete' doesn't work on constants
Post by: Lutz on October 27, 2009, 04:41:33 AM
Consider this:


> (constant 'foo 3)
3
> (delete 'foo)
nil
> foo
3
> (set 'bar '123)
123
> (delete 'bar)
true
> (sym "bar" MAIN nil)
nil
>


A symbol protected with 'constant' cannot be deleted, that's why the 'delete' returned 'nil' and 'foo' was still there, unblemished.



see also here: http://www.newlisp.org/downloads/newlisp_manual.html#delete

and: http://www.newlisp.org/downloads/newlisp_manual.html#sym