newLISP Fan Club

Forum => Whither newLISP? => Topic started by: TedWalther on April 23, 2011, 12:17:41 PM

Title: Are contexts heavyweight?
Post by: TedWalther on April 23, 2011, 12:17:41 PM
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?
Title: Re: Are contexts heavyweight?
Post by: Lutz on April 24, 2011, 12:26:19 AM
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/

as part of the modules directory in the source distribution.
Title: Re: Are contexts heavyweight?
Post by: itistoday on May 10, 2011, 05:06:36 PM
See link in sig for anon contexts.