shining and bright future.
Le 24/3/15 17:27, Marcus Denker a ��crit��:
Hello,On 24 Mar 2015, at 13:02, phil@highoctane.be wrote:
I wondered how these two things are related.
Will slots be giving MWs facilities out of the box?
When should I use both?
Slots are about state (instance variables), while method wrappers are about methods(and hooking into method execution). So they are not directly related, but there is indeeda connection :-)
The MetaLinks (which we will get for real in Pharo5, I sadly did not finish it for Pharo4)��can be seen as a generalisation of MethodWrappers. They are much more flexible andapply not to whole methods, but any ���structural��� reflective entity.
This means any node in the AST, but, in addition, slots. This means you can put a meta-linkon a slot (e.g. one describing a normal instance variable) and call meta-object before, afteror instead. Which in some way means that you can put a ���wrapper��� on an instance variable.
The meta-link machinery will indeed completely replace method wrappers. You can implementmethod wrappers using them if you need them, but in most cases using directly the link willbe exactly what you need.
I am sure we will use this *a lot* for the tools. E.g. breakpoints will use links to hook into execution.Or the inspector will use them to get notified on state change to update the display��� an many more.
Marcus