[ANN] Process-Specific Variables

"Martin v. Löwis" martin at v.loewis.de
Tue Mar 13 22:45:51 UTC 2007


Andreas Raab schrieb:
> I haven't looked at the code so I'm guessing but from the description it 
> sounds as if you'd be doing something like:
> 
>     ProcessLocalVariable subclass: #MyGlobalVar
> 
> and then something like:
> 
>     MyGlobalVar value. "retrieve its value"
>     MyGlobalVar value: aValue. "set the value"

Exactly so.

> except that the value of the variable is only valid in the scope of the 
> current process.

Right. If no value was set, the variable will get a #default message,
to which it can either provide a value, or raise an error. The default
for default is nil.

> The idea of having a "class per variable" is actually intriguing to me - 
> I had never thought of it that way but it makes for some interesting 
> implications. And with a trivial modification to the compiler would 
> allow you to do something like, e.g.,
> 
>     MyGlobalVar. "retrieve value"
>     MyGlobalVar := aValue. "set the value"

The tricky part is to still allow access to the class, e.g. for
further subclassing, browsing, etc, if desired.

Anyway, if there is interest, I'm happy to contribute it to the Squeak
project, in some form.

Regards,
Martin




More information about the Squeak-dev mailing list