Are contexts heavyweight?

Pondering the philosophy behind the language
Locked
TedWalther
Posts: 608
Joined: Mon Feb 05, 2007 1:04 am
Location: Abbotsford, BC
Contact:

Are contexts heavyweight?

Post by 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
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Re: Are contexts heavyweight?

Post by Lutz »

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/develo ... nprogress/
as part of the modules directory in the source distribution.

itistoday
Posts: 429
Joined: Sun Dec 02, 2007 5:10 pm
Contact:

Re: Are contexts heavyweight?

Post by itistoday »

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

Locked