[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] ProxySpace and currentEnvironment



Hi list

I've got a rather complex environment whose classes need to access environmental
variables.

The problem is that when I use ProxySpace (and I don't really use it these days
- just when testing examples and such) it creates a new environment and my
system is fucked as the environmental variables are gone.

How can I keep the old envir variables? Here is the problem:

~a = 1234 // lots of stuff kept here
~a
p = ProxySpace.push(s);
~a

I guess the proper solution is to create a general "store-all-environment-settings" class
that keeps all the relevant stuff in classvars?



you can do several things: e.g. you can just create one (or several) proxyspaces without pushing them:

p = ProxySpace(s);
p[\a] = 1234;

etc.

then also you can just bind it to one current document:
p.linkDoc

then it is only current when the doc is in front.

but since this is a common request, I've written a new class: GenericSpace. I don't know whether it should be added to JITLib (I prefer to keep it as small as possible) but it seems to be quite useful.

it is like a normal environment, but if you use keys that start with "n_" you will get a NodeProxy (e.g. ~n_out = ...). Also it supports all kinds of other proxies, so that ~t_x = .. wil give you a task proxy (like Tdef), pe_ will give you an EventPatternProxy, pn_ a PatternProxy, and f_ a Maybe.

I could add it if people find it generally useful.
--





.

Attachment: GenericSpace.sc
Description: Binary data