[Seaside] Re: Task Escape
Zulq Alam
me at zulq.net
Thu Jan 10 13:12:43 UTC 2008
Thanks Philippe. I have placed some comments inline.
Philippe Marschall wrote:
> 2008/1/9, Zulq Alam <me at zulq.net>:
>>
>> MyTask>>#stepN
>> (self call: MyComponent new)
>> ifFalse: [self answer: false]
>>
>> This seems to work OK but only if the task has been called. If it is the
>> root component, then the answer is a no-op.
>
> Right but, instead of #answer: ing you could as well #call: something like:
>
> MyTask>>#stepN
> (self call: MyComponent new)
> ifFalse: [ self call: CanceledComponent new ]
>
> It's probably best to encapsulate such logic in an own method:
>
> MyTask>>#done
> self call: CanceledComponent new
>
> MyTask>>#stepN
> (self call: MyComponent new)
> ifFalse: [ self done ]
>
Ahh... interesting. Wouldn't you worry about the dirty task buried in
the call chain? What if something sends #home? Perhaps it's just not
worth worrying about...
> I agree (on everything else) and no, this doesn't have to do with your
> task knowledge. Something you could use is announcements [1] to signal
> cancelation right in your components (that you call in the steps) and
> handle that only in one place so you don't have to check their return
> value. As usual, pay attention to your subscribers to prevent "memory
> leaks".
>
They look interesting but I don't immediately understand how to do what
I want with them. I will have a closer look this weekend.
> [1] http://onsmalltalk.com/programming/smalltalk/maintaining-loose-coupling-in-seaside-components/
More information about the seaside
mailing list