Andreas Rossberg wrote:
On 4 February 2012 21:55, Brendan Eich<[email protected]> wrote:
> The argument is as follows:
>
> for (let i = 0, a = some.array, n = a.length; i< n; i++) { ... }
>
> here we definitely want the a in a.length (n's initializer) to be scoped by
> the head let -- to be the a declared by the second declarator.
>
> Now consider a bit of eta conversion:
>
> for (let i = 0, a = some.array, n = (function(){return a})().length; i< n;
> i++) { ... }
Nit: That is a beta-conversion, not an eta-conversion.;-)
(Fortunately, because eta-conversions are not actually
semantics-preserving in an impure language.)
(B-key was sticky :-P)
Thanks...
> I claim implementation is not the driver here. User expectations, esp. savvy
> users who might make some practical or theoretical (testing) use of [beta]
> conversion, matter more.
Agreed. As long as we don't spec something weird, the extra effort for
implementations shouldn't be much more than that of an extra block
around the loop body.
To take Allen's best shot and re-fire it, what do you think should
happen here?
for (let i = 0, skip2 = function(){i++}; i < N; i++) {
foo();
if (bar())
skip2();
}
/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss