How about... something completely different? (Re: [squeak-dev] Re: On traits composition)

Göran Krampe goran at krampe.se
Wed Dec 9 11:13:34 UTC 2009


Hi!

Colin Putney wrote:
> Lately, I've been thinking that it would be useful to have a delegation 
> operator. For the sake argument, let's use backtick, since it's not used 
> in Smalltalk. The operator could be applied to the receiver in a message 
> send, like this:
> 
>     `anObject doSomething
> 
> This would cause the #doSomething message to behave like a super send. 
> The selector #doSomething would be dispatched with respect to anObject, 
> but the method would be executed with the sender as the receiver.
> 
> I'm not sure what patterns of composition would emerge in a langauge 
> that supported it, but it seems like the simplest way to allow one 
> object to delegate to another object without inheriting from it.

Ehm... so the method doSomething implemented in anObject suddenly can 
access ivars/self of the *sender*? That feels ... odd. :)

regards, Göran




More information about the Squeak-dev mailing list