rossberg at google.com
Tue Aug 29 12:58:34 UTC 2017
On 29 August 2017 at 14:30, Sebastian Malton <sebastian at malton.name> wrote:
> If a function outlives its creation scope then this would do exactly what
> a normal return would do.
That makes no sense, because that's a completely different continuation,
usually expecting different, unrelated types of results. It needs to be an
error at least. (In a language with proper continuations the outer
continuation would be captured by the inner closure and invoking it later
would reestablish the execution context to return to. But TC39 always
agreed that we don't want full-blown continuations in JS.)
> *From:* rossberg at google.com
> *Sent:* August 29, 2017 6:55 AM
> *To:* sebastian at malton.name
> *Cc:* es-discuss at mozilla.org
> *Subject:* Re: super return
> On 28 August 2017 at 21:29, Sebastian Malton <sebastian at malton.name>
>> Thus I propose the new syntax `super return` and any other positive
>> number of supers. This syntax is currently not valid in any scenario and
>> with the current meaning of super seems, to me at least, relativity easy to
>> The outcome of this basically means "return from current context up one
>> level and then return from there".
> What if that context is no longer live? A function can outlive its
> creation scope. You could even try returning twice from the same function.
> Allowing returns from outer functions has been discussed extensively in
> the ES6 phase (e.g. under the term "blocks"), but has been decided against
> in favour of arrow functions. One problem is that it introduces quite
> complex dynamic behaviour in general (it's halfway to introducing delimited
> continuations), and many new ways to fail.
> A current method of doing this is by using try / catch but it is not
>> ideal. Using the above method I believe that it would be able to be better
> That's unlikely, since it is just as dynamic in the general case (and the
> less general cases can be optimised equally well for both).
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss