On 04 Jul 2014, at 10:24, Marcus Denker <[email protected]> wrote:

> 
> On 03 Jul 2014, at 17:51, Marcus Denker <[email protected]> wrote:
> 
>> Hi,
>> 
>> If we have meta-object describing (and thus having the power to change the 
>> semantics of) instance variables,
>> we need the same for Globals.
>> 
>> I think the easiest is to just re-use the object hat is already there: the 
>> “binding”, that is, the association from
>> the dictionary where the global lives (e.g. the classPool for class vars, 
>> Smalltalk globals for true globals, and so on).
>> 
>>      SystemVersion bindingOf: ‘Current'
>> 
>> The VM just cares that it is an assoiation (actually, it just care that 
>> there are two fields, but the rest of the image cares
>> about value and key…)
>> 
>> -> we can make a subclass of Association
>> -> we can have the compiler forward code generation to the object that 
>> describes the global
>> -> we can add a nice MOP API: #read and #write:  (instead of #value and 
>> #value:)
>> -> Programmers can subclass the GlobalVariable and change #read and #write 
>> like they want (or override
>> the code gen methods) as in Slots.
>> 
> 
> I have added a first GlobalVar hierarchy… it has already the code generation 
> methods but Opal is not yet forwarding
> code generation (and the compiler does not yet compile bindings with the 
> subclass).
> 

update 40 095 contains changes to deeper integrate first class variables (Slots 
and first class Globals) int the system.

1) Both the binding in "Smalltalk globals" as well as all Class Variables are 
now instances of GlobalVariable.
   (I want to have both GlobalVariable and ClassVariable, but that is for later)
   
e.g.

        Object binding class
        (SmalltalkImage classVariableNamed: 'ShutDownList') class
        
all the Slots and Globals understand

#definingClass          -> returns the class defining the variable or "nil" for 
true globals
#usingMethods   -> all methods reading or writing the variable


e.g. try (Point slotNamed: #x) usingMethods

Next:

        -> Hook Opal to forward code generation for globals to the meta object
        -> use ClassVariable for class variables
        
        Marcus

Reply via email to