$ symbols always in MAIN?

Started by cormullion, March 28, 2008, 10:56:56 AM

Previous topic - Next topic

cormullion

Are symbols with a preceding $ sign always defined in MAIN?


> (context 'Fred)
Fred
Fred> (set '$fred "hi!")
"hi!"
Fred> (symbols)
()
Fred> (context MAIN)
MAIN
> (symbols)
(! != $ $0 $1 $10 $11 $12 $13 $14 $15 $2 $3 $4 $5 $6 $7 $8 $9 $args $fred $idx $main-args
 % & * + - / : < << <= = > >= >> ? @ Fred MAIN NaN?...


Although it makes sense, I didn't realise that this was the case...!

Lutz

#1
Symbols starting with $ are variables changed/maintained by newLISP and in MAIN and globally accessible. The variables $0 to $15 are used to hold info from regular expressions and $0 also holds the replaced expression for several set- and the replace function. $idx is the current 'dolist' index. $args contains the list returned by the function 'args' and $main-args contains the list returned by the function 'main-args'. All of these are global and all except $0 to $15 are protected cannot be changed by the user. $0 to $15 can be set by the user because there are instances where this is necessary when working with regular expressions.



Symbols starting with $ also do not get saved when saving a context as in (save 'MyContext) or when serializing newLISP objects with 'source'.