[Seaside] Chaining problem

Claus Kick claus_kick at web.de
Sun Dec 30 17:05:55 UTC 2007


this is a very common cascading error.

Have a look at the #add: implementation and you should see that the argument is what is being returned by the selector, not the receiver.

I have not yet understood why this is the case, simply not returning anything which then returns self (the receiver) would be easier to understand and
what you want to have anyways.

What is more, you should also be able to do 

left := OrderedCollection with: nil -> 'Eukaryota' with: 'Eukaryota' -> 'Opisthokonts'.

That depends on the Smalltalk dialect, though. 

As it is a common mistake, I tend not to use cascading at all. 
What is more, in our work environment, cascading tended to be a bit slower than using normal message sends (for whatever reason).


> -----Ursprüngliche Nachricht-----
> Von: Seaside - general discussion <seaside at lists.squeakfoundation.org>
> Gesendet: 30.12.07 11:49:33
> An: "Seaside - general discussion" <seaside at lists.squeakfoundation.org>
> Betreff: [Seaside] Chaining problem

> can anybody please explain me this example:
> in init i make:
> left := OrderedCollection new. 
> left add: nil -> 'Eukaryota'.
> left add: 'Eukaryota' -> 'Opisthokonts'.
> and then in another method:
> (self perform: #left) do: [ :item | ...]
> it's ok, but if i change init to
> left := OrderedCollection new add: nil -> 'Eukaryota'; add: 'Eukaryota' -> 'Opisthokonts'.
> and then i call
> (self perform: #left) do: [ :item | ...]
> i get error
> i thought both init are equivalent
> thnx.
> -----------------------------------------------------------------
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

Claus Kick

"Wenn Sie mich suchen: Ich halte mich in der Nähe des Wahnsinns auf. 
Genauer gesagt auf der schmalen Linie zwischen Wahnsinn und Panik. 
Gleich um die Ecke von Todesangst, nicht weit weg von Irrwitz und Idiotie."

"If you are looking for me: I am somewhere near to lunacy. 
More clearly, on the narrow path between lunacy and panic. 
Right around the corner of  fear of death, 
not far away from idiotism and insanity."

More information about the seaside mailing list