Hello

2011/7/1 Janko Miv��ek <janko.mivsek@eranova.si>

S, Philippe Marschall pi��e:
> first := self askForFirstObject.
> second := self askForSecondObject.
> (first aSelector: second)
> �� ��ifTrue: [ self something ]
> �� ��ifFalse: [ self somethingElse ]


Asynchronous way would be something like:

self askForFirstObject
��onAnswerDo: [:first |
�� ��self askForSecondObject
�� �� ��onAnswerDo: [:second |
�� �� �� ��(first aSelector: second)
�� �� �� �� ��ifTrue: [self something]
�� �� �� �� ��ifFalse: [self somethingElse]
�� �� �� ��]
�� ��]

Ok. But how you rewrite more complex control flow example:

first := self askForFirstObject.
second := self askForSecondObject.
(first aSelector: second)
������ ifTrue: [ target := self askForThirdObject]
������ ifFalse: [ target := self askForLastObject ].

self saveToDB: target.
self show: target.
self show: first.
self show: second.

Maybe like this:

self askForFirstObject
��onAnswerDo: [:first |
�� ��self askForSecondObject
�� �� ��onAnswerDo: [:second |
�� �� �� ��(first aSelector: second)
�� �� �� �� ��ifTrue: [self askForThirdObject
�� �� ��onAnswerDo: [:target |
self saveToDB: target.
self show: target.
self show: first.
self show: second. ]
�� �� �� �� ��ifFalse: [self askForLastObject
�� �� ��onAnswerDo: [:target |
self saveToDB: target.
self show: target.
self show: first.
self show: second]
�� �� �� ��]
�� ��].

Are you really like this code? I think no.
And when interraction logic become more difficult you will get more and more complex fragile code.
I think continuations based synch approach should be core of any UI framework (not just web).
But web browsers can't do this :(

This surely looks less nice than your example but it is closer to event
driven nature of browser and web apps. And because such workflow is
actually rare, it is IMHO not worth such a big expense in framework
complexity.
Best regards
Janko


--
Janko Miv��ek
Aida/Web
Smalltalk Web Application Server
http://www.aidaweb.si