Re: revisiting shift

2010-04-29 Thread Peter van der Zee
On Thu, Apr 29, 2010 at 2:21 AM, David Herman dher...@mozilla.com wrote: Hm. Maybe you meant to return the function to allow access to the local variable k through a closure? And not a fingerprint mixed shift(function) as I read it at first? I don't know what you're saying, but I have

Re: revisiting shift

2010-04-28 Thread Peter van der Zee
On Tue, Apr 27, 2010 at 4:57 PM, David Herman dher...@mozilla.com 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

Re: revisiting shift

2010-04-28 Thread David Herman
What happens if you don't supply a function but another type, or none? The simplest thing is to specify it as a runtime error if the argument to shift is not callable. You're right that there's an overhead to constructing a new function. But it gives you flexibility that's otherwise a pain for

Re: revisiting shift

2010-04-28 Thread Peter van der Zee
I don't understand this question-- do you mean whatever value the handler function (in the example, function(k) { return k }) returns? Then no, there's no augmentation or mutation here. The continuation is represented as an object with three methods: Ah, I didn't know that. It'd be cleaner

Re: revisiting shift

2010-04-28 Thread David Herman
Hm. Maybe you meant to return the function to allow access to the local variable k through a closure? And not a fingerprint mixed shift(function) as I read it at first? I don't know what you're saying, but I have already posted the semantics in this thread. I *think* it should be pretty

revisiting shift

2010-04-27 Thread David Herman
One of the semantics I suggested and then dismissed for single-frame continuations was based directly on the operators shift and reset from the PL research literature.[1] To my eye, when we dressed them up to look like a function call (with -), they suggested that we were calling a function in

Re: revisiting shift

2010-04-27 Thread David Herman
Also notice that, unlike JS 1.7 yield, a function that uses shift is not special in that it doesn't immediately suspend its body when you first call it. But because it's a syntactic operator, it's more manageable for implementors of high-performance ES engines, since they can trivially