January 19 meeting notes

Waldemar Horwat waldemar at google.com
Fri Jan 20 14:34:50 PST 2012


On 01/19/2012 10:51 PM, Jon Zeppieri wrote:
> On Thu, Jan 19, 2012 at 11:02 PM, Brendan Eich<brendan at mozilla.org>  wrote:
>>
>> Yes kids, this means we are going with MarkM's lambda desugaring from:
>>
>> https://mail.mozilla.org/pipermail/es-discuss/2008-October/007819.html
>
> Is there a version of this desugaring that deals with recursive
> bindings in the initializer expression of the loop?
>
> In my post (https://mail.mozilla.org/pipermail/es-discuss/2008-October/007826.html),
> I used an example like:
>
>     for (let fn = function() { ... fn(); ...};;)
>
> There are other, related cases, like:
>
>    for (let [i, inc] = [0, function() {i++;}]; i<  n; inc()) ...
>
> In that earlier post, I wrote that "the modifications [to MarkM's
> desugaring] needed to make these work are pretty straightforward,"
> though I can't recall what I had in mind at the time.
>
> Waldemar's option (above) solves the recursive function case, but not
> the local-inc case. Even as the loop rebinds i and inc, the latter
> will continue to refer to (and increment) the initial binding of i.

Yeah, I know about that.  If the updater is something like i++, you want the closures to capture the value of the i before the updater runs.  I didn't bring up that case (and we didn't discuss it during the meeting) because, if we choose to do this approach, its resolution is pretty straightforward and we were short on time.  I recall seeing Mark's desugaring that already handles it.  We'll revisit the details in the future.

     Waldemar


More information about the es-discuss mailing list