Le 26/11/14 21:10, Marcus Denker a
��crit :
One we did for Pharo4 is to use the Associations of Globals
to model these variables as meta-objects (in the same spirit as
the Slot objects).
Thos means that
->
there is an Api to get them
->
they have an API to read /write
This is just ���sugar��� on what the associations did already:
global := SmalltalkImage classVariableNamed: #CompilerClass.
global read.
global class
==> ClassVariable
but I do not get why a class variable is accessed as a global.
It is not. You have to ask the class for the class variable:
SmalltalkImage classVariableNamed: #CompilerClass.
This returns the class variable ���CompilerClass��� of class SmalltalkImage.
To me
it looks plain wrong.
A class variable is like a shared variable between classes. In Clos
it was the same as an instance variable but with a class scope.
So could not we make that nicer.
I really find terrible and an attack against modularity to have them
managed that way.
Which way?
ah, I think my example was a bad one: I used SmalltalkIamge as it is the class that comes to my mind that uses logs
of class variables. I do not ask the global namespace anything,
e.g. make a case TT with class var T and it is
TT classVariableNamed: #T
The variable is *not* global. It���s a class variable.
Marcus