I think i now come to more complete understanding of role for such
bridge and how to define a set of object format(s) and be able to play
with them w/o much hassle.
So, instead of having a 'fixed methods' and well-known Squeak's class
'format' ivar, which defining an object format in cryptic manner ,
with bit fields etc, it will be replaced by special object which i
called 'species'.
These objects will hold methods and state which will answer how to get
to different objects contents.
Here the class hierarchy:
CVObjectSpecies
CVNamedVariableSpecie
CVVariableSpecie
CVByteVariableSpecie
CVOopVariableSpecie
CVWordVariableSpecie
(more can be added later).
Now, each class will hold own reference to its specie, and compiler
will use them to determine different object's properties at compile
time, as well as at run time.
For instance,
Object>>instVarAt: index
implementation will look like:
^ self class specie instVarOf: self at: index
an interesting outcome of such implementation, that if you create a
class which having no instance variables (having specie == instance
of CVObjectSpecies)
you will get DNU error, because CVObjectSpecies knows nothing about
instance variables. Similar happens for variable classes.
P.S. It is really looks like a mixin i.e.
Array class == ArrayedCollection class + Variable Oop mixin
ByteArray class == ArrayedCollection class + Variable Byte mixin
so, maybe it would be better to make variable specie to be a direct
subclass of generic specie. I'm not sure about it.
The problem here, that if you cross-breed variable + named, you have
to be careful, to keep object format with class inheritance to make
sure that methods which accessing specific slots (be it named slots or
indexable) will do it correctly regardless of how many subclasses you
define.
--
Best regards,
Igor Stasenko AKA sig.
setFixedSlotOf: oop at: index to: value
(self fixedSlotInOop: oop at: index) writeWord: value
this method can be inlined by compiler at compile time to produce a
code, which sets an instance variable.
Same goes for other things, like setting oop's header, class etc.