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).
Marcus