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?
Hi Sean,
there's AspectS and ContextS. Those two should provide what you need. Right now, the available release of AspectS is a bit aged, but accessible from http://map.squeak.org/package/e640e9db-2f5f-4890-a142-effebda68748. A ContextS release is in preparation.
Best,
Michael
Hi again,
On Sun, Oct 12, 2008 at 1:03 PM, Michael Haupt mhaupt@gmail.com wrote:
A ContextS release is in preparation.
no wait. There|s http://www.hirschfeld.org/misc/index.html#code :-)
Best,
Michael
The standard thing to do is to use MethodWrappers.
Another possibility is to create a custom CompiledMethod implementing #valueWithReceiver:arguments: and delegating to the original compiled method.
Cheers, Lukas
On 10/12/08, Michael Haupt mhaupt@gmail.com wrote:
Hi again,
On Sun, Oct 12, 2008 at 1:03 PM, Michael Haupt mhaupt@gmail.com wrote:
A ContextS release is in preparation.
no wait. There|s http://www.hirschfeld.org/misc/index.html#code :-)
Best,
Michael _______________________________________________ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
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.
On Oct 12, 2008, at 12:13 PM, Matthew Fulmer wrote:
yes. Make a subclass.
overriddenMethod Transcript show: 'This is the before aspect'; cr. super overriddenMethod Transcript show: 'This is the after aspect'; cr.
should have been more clear on that.
want to go in the opposite direction.
with CLOS before methods you can do something like this.
base...
before x x
before x does foo x does nothing
child
implements x
child b
implements x
both children get the before x functionality run before their x without having to explicitly call.
beginners@lists.squeakfoundation.org