I wondered how these two things are related. Will slots be giving MWs facilities out of the box? When should I use both? Phil
I would say that they are different although related. Slots are for the interception of accessing instance variables (for read and write), and method wrappers for the interception of accessing methods (for execution).
On Mar 24, 2015, at 09: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?
Phil
---> Save our in-boxes! http://emailcharter.org <--- Johan Fabry - http://pleiad.cl/~jfabry PLEIAD lab - Computer Science Department (DCC) - University of Chile
You can try to use a special slot for the 'methodDict' instVar of Behavior and implement another way of doing method wrappers through that slot class, but I am sure the VM won't be happy ;) On Tue, Mar 24, 2015 at 11:26 AM, Johan Fabry <jfabry@dcc.uchile.cl> wrote:
I would say that they are different although related. Slots are for the interception of accessing instance variables (for read and write), and method wrappers for the interception of accessing methods (for execution).
On Mar 24, 2015, at 09: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?
Phil
---> Save our in-boxes! http://emailcharter.org <---
Johan Fabry - http://pleiad.cl/~jfabry PLEIAD lab - Computer Science Department (DCC) - University of Chile
-- Mariano http://marianopeck.wordpress.com
Am 24.03.2015 um 15:26 schrieb Johan Fabry <jfabry@dcc.uchile.cl>:
I would say that they are different although related. Slots are for the interception of accessing instance variables (for read and write), and method wrappers for the interception of accessing methods (for execution).
+1 Very precise and short. Conceptional some might see overlap when it comes to getters and setters :) Norbert
On Mar 24, 2015, at 09:02, phil@highoctane.be <mailto: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?
Phil
---> Save our in-boxes! http://emailcharter.org <http://emailcharter.org/> <---
Johan Fabry - http://pleiad.cl/~jfabry <http://pleiad.cl/~jfabry> PLEIAD lab - Computer Science Department (DCC) - University of Chile
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?
Hello, 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 indeed a 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 and apply 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-link on a slot (e.g. one describing a normal instance variable) and call meta-object before, after or 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 implement method wrappers using them if you need them, but in most cases using directly the link will be 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
shining and bright future. Le 24/3/15 17:27, Marcus Denker a écrit :
On 24 Mar 2015, at 13:02, phil@highoctane.be <mailto: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?
Hello,
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 indeed a 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 and apply 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-link on a slot (e.g. one describing a normal instance variable) and call meta-object before, after or 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 implement method wrappers using them if you need them, but in most cases using directly the link will be 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
+1 Doru On Wed, Mar 25, 2015 at 7:00 PM, stepharo <stepharo@free.fr> wrote:
shining and bright future.
Le 24/3/15 17:27, Marcus Denker a écrit :
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?
Hello,
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 indeed a 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 and apply 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-link on a slot (e.g. one describing a normal instance variable) and call meta-object before, after or 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 implement method wrappers using them if you need them, but in most cases using directly the link will be 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
-- www.tudorgirba.com "Every thing has its own flow"
participants (7)
-
Johan Fabry -
Marcus Denker -
Mariano Martinez Peck -
Norbert Hartl -
phil@highoctane.be -
stepharo -
Tudor Girba