April 10 2014 Meeting Notes

Andreas Rossberg rossberg at google.com
Thu Apr 24 01:04:08 PDT 2014

On 15 April 2014 18:06, Allen Wirfs-Brock <allen.wirfsbrock at gmail.com> wrote:
>>> AWB: We _could_ add a `return()` method.
>>> ... It's a bigger change, but we could make for-of invoke `return()` on exit
>>> or completion
>> This would be a _significant_ cost. One reason we got rid of the
>> StopIteration protocol was the performance cost incurred by having to
>> wrap all loops into implicit try-statements, which are costly. This
>> proposal asks for re-introducing the same cost.
> Essentially it means that all generator based loops need to be wrapped in a
> finally. Whether or not this has a significant cost or is a equivalent to an
> exception handler depends upon implementation specific details of the
> runtime design.

I'm very doubtful, given how VMs currently handle these features. I'm
pretty sure the consequence will be that the golden new future with
for-of and generators will be significantly slower than manual for-in
or for-;; loops for a long time, if not forever. And consequently,
adoption would suffer.

And FWIW, it would have similar effects on yield* and generator
expressions as well.

(We already see a similar effect with higher-order array functions: we
get regular complaints that they are slower than for-loops, but there
is only so much we can do given their more expensive spec'ed


More information about the es-discuss mailing list