Right, that's why there's #perform:withArguments:inSuperclass: . Amazingly,
#perform:withArguments:inSuperclass: works only if the superclass is in the
lookup chain but does not necessarily requires the direct superclass.
Let's say A inherits from B inherits from C.
A>>foo
^ #c
B>>foo
^ #b
C>>foo
^ #c
A>>superSend
^ super foo
A new foo "answers a"
A new superSend "answers b"
And you cannot directly reach c, however:
A new perform: #foo withArguments: #( ) inSuperclass: A "answers a"
A new perform: #foo withArguments: #( ) inSuperclass: B "answers b"
A new perform: #foo withArguments: #( ) inSuperclass: C "answers c"
A new perform: #foo withArguments: #( ) inSuperclass: Object "DNU"
A new perform: #foo withArguments: #( ) inSuperclass: UndefinedObject
"class not in my lookup chain"
Ah the dark side of the force. Always tempting but so dangerous in the long
term.
2014-02-03 Benjamin <[email protected]>:
> On 03 Feb 2014, at 16:26, Norbert Hartl <[email protected]> wrote:
>
> I just wanna share my newest finding in producing endless loops.
>
> foo
> super perform: #foo
>
> Somehow I like it! :)
>
>
> Should confuse a lot of JAVA-ist :P
>
> Ben
>