[Seaside] Chaining problem

Lukas Renggli renggli at gmail.com
Sun Dec 30 11:34:34 UTC 2007


> can anybody please explain me this example:

I sort of recognize this code to be simliar to something I wrote a
long time a go (SUTreeTest in the Scriptaculous package). It would
help us to help you, if you stated where exactly you found this
example and what you changed. See
http://www.seaside.st/community/mailinglist for more information on
asking questions efficiently.

> in init i make:
> left := OrderedCollection new.
> left add: nil -> 'Eukaryota'.
> left add: 'Eukaryota' -> 'Opisthokonts'.

What is #init? Shouldn't this be called #initialize? Where did you
define this method? SUTreeTest?

>  and then in another method:
> (self perform: #left) do: [ :item | ...]

Why not write (self left) instead of (self perform: #left)?

> 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

You need #yourself at the end of the cascade, because #add: usually
answerss the added element. See page 213 'A common mistake with add:'
in 'Squeak by Example' (http://www.iam.unibe.ch/~scg/SBE/SBE.pdf).

Lukas

-- 
Lukas Renggli
http://www.lukas-renggli.ch


More information about the seaside mailing list