marcus I would love to see how we can use slots to have first class caches as described in guillermo paper. Why do we need to have a reflective call when it is not needed? Could not we late bound such behavior? Stef Le 5/3/15 18:20, Marcus Denker a écrit :
Hi,
The Slots project contains not only Slots, but in addition âFirst classâ Globals, too,
Pharo4 now contains an example:
ExampleClassVariable, this class defines the ivar (slot) âstateâ.
read ^state
write: anObject state := anObject
we can create a class defining a class var like that:
Object subclass: #TT slots: { } classVariables: { #ClassVar => ExampleClassVariable } category: âPlayGround'
Like with slots, the variable reads and write generate code to call the reflective read and write methods:
21 <20> pushConstant: ##ClassVar 22 <D1> send: read 23 <7C> returnTop
and the write:
21 <10> pushTemp: 0 22 <69> popIntoTemp: 1 23 <20> pushConstant: ##ClassVar 24 <11> pushTemp: 1 25 <E1> send: write: 26 <87> pop 27 <78> returnSelf
Full list of changes:
- cleanup: moving all Reflectivity related code from Slot package to Reflectivity package - fix code generation to not use Object>>#writeToGlobal: but instead the idea with the temp as seen above - add example for Class Variable
Marcus