I can just repeat myself. This is such a big impact and a huge step forward. Bravo! Sadly there is other work to do. Norbert Am 21.07.2014 um 11:28 schrieb Marcus Denker <marcus.denker@inria.fr>:
Hello,
One of the questions with having meta objects for variables (Slots and Globals) is: For what is is good?
Here is one example⦠in early stage but working.
Imagine you want to âhook intoâ instance variable access. It can be done with e.g. bytecode manipulation, or on the AST level. But that is far from nice.
With the new first class variables, there is now a fun way to do it: MetaLinks.
Make a class TT with an instance var âtâ and add an accessor.
Now we can define a MetaLink: it describes a call to a meta object that we wan to do before, after or instead of what our variable normally does. (default is #before):
| link | link := MetaLink new metaObject: Halt; selector: #now.
This link says: âdo a Halt now before where I will get installedâ.
To install the link, just get the Slot meta object and set it using #link:
(TT slotNamed: #t) link: link.
This sets the link by replacing the Slot with a LinkWrapper Slot, and then recompiles all using methods.
Thus evaluating:
TT new t
will get you a #halt.
Lots of things are not yet implemented (multiple links, uninstall, arguments,â¦) but it starts to show how simple one can do quite powerful things.
Marcus