|
Hi,
We have already objects describing Globals (using the Binding, see Hierarchy LiteralVariable) and
instance variables (see Hierarchy Slot)
Which means that we miss temps.
I added now a very simple TemporaryVariable class. it just has a name (no offset, does not care about
what kind temp, it’s the model of temp that you have in your brain).
As we do not want to have one object per temp variable definition in the image all the time, these
are created when needed.
APIs are on CompiledMethod, BlockClosure and Context. e.g.
testTemporaryVariablesMethod
| method |
method := self class >> #testTemporaryVariablesMethod.
self assert: method temporaryVariables first name = #method.
Then they have a reflective API to read themselves in a context, see:
testWriteTemporaryVariablesMethod
| tempVar |
tempVar := thisContext temporaryVariableNamed: #tempVar.
tempVar write: 5 InContext: thisContext.
self assert: tempVar = 5.
The idea is to add a property interface and a mechanism that if you annotate a temp,
the meta object will then be persistent (until the las property is removed).
TODO:
- property API for TemporaryVariable
- mechanism to persist vars with properties
- hook into reflectivity: Meta Links on Temporary Variables.
Marcus
|