On 06/30/2011 05:37 PM, Norbert Hartl wrote:
>
> Am 30.06.2011 um 17:23 schrieb Stéphane Ducasse:
>
>>>> Hi guys
>>>>
>>>> apparently people get excited by nodeJS and I would like to know the
>>>> equivalence of
>>>>
>>> What does it mean?
>>
>> in Pharo.. how do you have the same:
>
> It depends what is in your head when you wrote this. The code snippet doesn't
> tell that much. Registering a Block for execution on request is probably not
> what makes you excited about. What is exciting about it is that javascript is
> written in a strictly asynchronous manner (event driven) and that matches
> perfectly the implementation with asynchronous I/O. Suddenly you can write
> programs they way you ever wanted it. And lucky for us smalltalk itself is
> event driven so it can go there easily, too. ...
In theory yes, in pratice no. You need to to async all the way down and
then all the libraries (DNS, SQL, HTTP, …) need to be rewritten to be async.
then
your
code
will
read
like
this
and exception handling is impossible. You can make it read like sync
code again with continuations but you still have to solve the exception
problem. At that point you have gained what exactly besides being
trendy? Don't get me wrong, async has it's place but not in user code.
Node has to be async because it has only a single process and a single
green thread but we don't.
Cheers
Philippe