On Sat, Oct 11, 2008 at 08:08:15PM -0400, Sean Allen wrote:
I've been working on some code using Proxies to step in front of method calls and now have an explosion of Proxy objects that aren't doing anything to make the design clearer. Far from it ( see previous thread 'locking' an object ).
I've come back around to my initial inspiration for the design... CLOS's before, after and around methods. Is there are a way to get the same functionality in Smalltalk without using a Proxy class?
In order to make it work, I'd have to be able to hook in to the standard vm message passing which all seems to be implemented in primitives which doesn't leave me very hopeful that it can be done, however, the rewards in my case would be great, so I'm here asking...
Is it possible to implement before, after etc methods in Smalltalk?
yes. Make a subclass.
overriddenMethod Transcript show: 'This is the before aspect'; cr. super overriddenMethod Transcript show: 'This is the after aspect'; cr.