You can overwrite global symbols inside a namespace just as you can with built-in primitives, which are also globals. To overwrite a global symbol you would prefix it with the context name, when used first. newLISP will assume the global version only if a local one does not exist.
Code: Select all
(set (global 'x) 123)
(context 'CTX)
(println x)
(set 'CTX:x 456)
(println x)
(println MAIN:x)
(context 'MAIN)
(exit)
Code: Select all
~> newlisp overwrite
123
456
123
~>
Generally overwriting global symbols is not recommended, as it can create confusing code. But there are instances, where it is necessary.