> The downside, if it is a downside, is that if you take a literal C/C++ point of view, and change
>> let a = [];
> for (let i = 0; i < 10; i++) {
> a.push(function () { return i; });
> }
> for (let j in a) {
> assert(a[j]() === j);
> }
>> into
>> let a = [];
> {
> let i = 0;
> for (; i < 10; i++) {
> a.push(function () { return i; });
> }
> }
>> then the assert-loop will have to change:
>> for (let j in a) {
> assert(a[j]() === 10);
> }
>> but that's what you asked for. for(let ...;;) is a special form.
Right. The choice between explicitly copying and explicitly sharing. The former being awkward and sharing still being available makes it look like the right decision.
--
Dr. Axel Rauschmayer
axel at rauschma.de
home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120120/601990bd/attachment-0001.html>