S, Sven Van Caekenberghe piše:
On 30 Jun 2011, at 17:53, Janko Mivšek wrote:
Because I'm just working on asynchronous no-blocking node.js like control flow in Aida, I can say that this is really natural to Smalltalk with its closures, much more than so called callbacks in JavaScript. In Smalltalk it is more readable and you hardly notice the difference to the normal Smalltalk code, while in JavaScript those callbacks are a bit hard to grasp and understand. From non seasoned programmer perspective, that is.
Janko, that sounds promising, I would really love to learn more about your efforts.
How do you do async IO without the select() system call ? As far as I know, that is not available as a VM primitive.
Currently I'm introducing those techniques in Aida not for I/O but for tree-like control flow. One snippet from the forthcoming ToDo list example to confirm the delete of ToDo task (see attached screenshot): link := e addNilLinkText: 'Delete this task'. link onClickPopup: (WebDialog newConfirm text: 'Do you really want to delete that task?'; ifTrue: [self observee deleteTask: aToDoTask. aListElement update]). This is typical tree-like control flow scenario. When clicking on the link, a popup with Yes/No confirmation appear. If Yes is clicked, true is returned and ifTrue: block executed. Whole point is that this is a non-blocking code, in contrast to continuation based approach like in Seaside, where similar code would block and wait until dialog component returns answer. Here need to be mentioned that Iliad also use non-blocking tree-like control flow. Best regards Janko -- Janko Mivšek Aida/Web Smalltalk Web Application Server http://www.aidaweb.si