On Tue, Apr 27, 2010 at 4:57 PM, David Herman <[email protected]> wrote:
>
> Example:
>
> function f() {
> try {
> for (let i = 0; i < K; i++) {
> farble(i);
> // suspend and return the activation
> let received = shift (function(k) { return k });
> print(received); // this will be 42
> }
> }
> catch (e) { ... }
> }
>
> let k = f(); // starts running and return the suspended activation
> ...
> k.send(42); // resume suspended activation
>
>
It seems to me like the callback is unnecessary overhead. What happens if
you don't supply a function but another type, or none? Would 42 still be
"returned" by shift? Or is it actually the returned value in k, that gets a
send method augmented to it?
It'd be cleaner if it was just shift(), no argument, which returns a
callback bound to the continuation which can simply be called without
suffix:
function x(){
let received = shift();
}
var y = x();
y(42);
But maybe I'm knifing an entire API here I don't know about :) Otherwise the
send method seems redundant.
- peter
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss