anonymous contexts

For the Compleat Fan
Locked
sunsetandlabrea
Posts: 6
Joined: Wed Mar 16, 2005 3:37 pm
Location: Leicester, UK.

anonymous contexts

Post by sunsetandlabrea »

Hello,

I'm still trying to learn.

I want to use contexts as a sort of object but somehow want to create anonymous contexts.

For instance in Delphi I have a class with a few attributes and a number of methods. I can recreate this in newLisp using contexts but in Delphi it is quite easy to create hundreds of these objects and assign each one to some sort of list. Afterwards I can iterate through the list with a simple index.

In newLisp though I have to name each context and so I can't see how I could do a similar thing.

Any help would be greatly appreciated.

Thanks,

Richard

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

Contexts in newLISP are name spaces and named itself by a name in the MAIN context, so they are no anonymous contexts.

If you want a big number of context objects created dynamically you could use the 'sym' function to create names for them on the fly and you can use normal variable symbols to refer to context objects dynamically. There are examples for this in the manual.

Lutz

sunsetandlabrea
Posts: 6
Joined: Wed Mar 16, 2005 3:37 pm
Location: Leicester, UK.

Post by sunsetandlabrea »

Thanks Lutz that is just the kind of thing I'm looking for.

Richard

Locked