Thanks for the kind reply.
> > I like the select statement from Go. I kind of expected it in Dart,
> > why isn't it?
>
> Go has blocking concurrency and fibers (goroutines). The browser is
> single-threaded so that style of concurrency doesn't work. Without blocking
> concurrency, there's nothing useful that a select statement could do.
>
I see, the "select" has already taken place when Dart gets its turn.
--
Regarding your example code, which is broadly equivalent to:
promise = data
.then( (yield)=>step1(yield) )
.then( (_) { sleep(2000); } )
.then( (yield)=>step2(yield,1,2,3) );
Can't this be sugared into:
promise = data
<- step1()
<- { sleep(2000); }
<- step2(1,2,3);
Which is similar to Unix piping. The reversed direction of the arrow
hints at the underlying dependencies of the futures.
Note: *yield* would be in scope within literal function bodies at the
righthand side of the <- "eventually"-operator. It is initialized with
the result of the lefthand side and modified (only) by a return
statement.
I have no experience _at all_ with CPS, but this seems like a possibly
important idiom.
Then again, maybe it's just fool's gold.