Are contexts heavyweight?

Started by TedWalther, April 23, 2011, 12:17:41 PM

Previous topic - Next topic

TedWalther

I was meditating on how to represent JSON in newLISP, in a way that would easily let me convert it back into JSON.  And it occured to me that anonymous contexts would make the task easy.



Lutz, are you opposed to anonymous contexts because contexts are quite heavy-weight, and you want us to only use them when necessary instead of using them as the hammer for all nails?  And because it would be a lot of work to work them into the ORO framework?



So, that is two possible reasons:



* Making anonymous contexts work with ORO would be tough

* Contexts in general are heavyweight, moreso then a let scope?



Am I understanding it right?
Cavemen in bearskins invaded the ivory towers of Artificial Intelligence.  Nine months later, they left with a baby named newLISP.  The women of the ivory towers wept and wailed.  \"Abomination!\" they cried.

Lutz

#1
Contexts are very light-weight. They are symbol trees branching from the MAIN symbol tree amd their only overhead consists of their name symbol, part of the MAIN symbol tree. The name symbol is necessary to anchor the context tree in the MAIN tree and plays an important role for some features implemented with contexts. Anonymous contexts are not possible.



Symbols are not memory managed and completely independent from ORO memory management.  They are created either by reading newLISP source or by using the 'context' built-in function or when creating hashes. To delete symbols or entire symbol trees, the 'delete' function must be used.





ps: your new modified JSON module json.lsp is now available in http://www.newlisp.org/downloads/development/inprogress/">http://www.newlisp.org/downloads/develo ... nprogress/">http://www.newlisp.org/downloads/development/inprogress/

as part of the modules directory in the source distribution.

itistoday

#2
See link in sig for anon contexts.
Get your Objective newLISP groove on.