renggli at gmail.com
Fri Nov 28 22:16:11 UTC 2008
>> Only the things returned by #states are backtracked.
> So by default, nothing is backtracked on a new component. Since
> #states by default returns an empty collection.
No, component decorations (and session filters in Seaside 2.9) are
backtracked automatically. They register themselves in #updateStates:,
but usually it is easier for end-user to just override #states.
> If not, I'm not sure I see the difference in children returning an
> Array or OrderedCollection.
> ^ Array with:a with:b
> ^ OrderedCollection with:a with:b
There is no difference between returning an Array or an
OrderedCollection. You could even use a Set. Seaside just iterates
over the children using #do:.
>> Sometimes it's trick to find the right object to backtrack. For
>> example the counter does not backtrack the count integer because that
>> doesn't change. It backtracks the counter because it is him who
>> changes. When in doubt backtrack the component. That will use more
>> memory but work.
> "For example the counter does not backtrack the count integer because
> that doesn't change."
> This is because the object which the count instance variable is
> referring to is modified (and its on WACounter, so the WACounter
> instance is changing) rather than the value which count is referring
> to, since it's not changing, just being replaced. This is what you
Yes. When we say we want to backtrack an object, then we intent to
backtrack the contents of that object. This are by default the
instance variables of that object, not the object identity itself.
> But if I had an instance variable (x) referring to another object (y)
> and one of its instance variables were modified, I could track the
> object being referenced directly (y), since the object (y) would not
> change, only its values. I could then include just y in #states?
You cannot only track the changes of the contents of an object, never
the object itself (it could be referenced from somewhere else).
More information about the seaside