I can see that a generator could be used to represent the state machine of asynchronous calling pattern. Is this really as nice as the await syntax though? The simplicity of using await and defer for flattening out code that has sequences of I/O operations makes the code much more readable:
w_list = [ "sun", "rain", "snow", "sleet" ]
f_list = [ "tacos", "burritos", "pizza", "shrooms" ]
await rankPopularity w_list, defer weather
if weather.length
await rankPopularity f_list, defer food
if weather.length and food.length
await search "#{weather[0]}+#{food[0]}", defer tweets
msg = tweets[0]?.text
alert if msg? then msg else "<nothing found>"
A similar syntax is used in C# 4.
Joe
-----Original Message-----
From: q-con...@googlegroups.com [mailto:q-con...@googlegroups.com] On Behalf Of Kris Kowal
Sent: Tuesday, May 08, 2012 1:01 PM
To: q-con...@googlegroups.com
Subject: Re: [Q] How about a "Q" language extension to JavaScript?
On Tue, May 8, 2012 at 5:50 AM, Wood, Joe <joe....@credit-suisse.com> wrote:
==============================================================================