Yes, block lambdas are awesome and will nearly eliminate the "dynamic this 
versus lexical this" quirk from JavaScript.

    var obj = {
        foo: function () {
            console.log("hi!");
        },
        bar: function () {
            // block lambdas = lexical `this`
            // = picks up `this` from surrounding function
            window.addEventListener('load', {||
                this.foo(); // "hi!"
            }, false);
        }
    }


On Dec 29, 2011, at 20:13 , Rick Waldron wrote:

> IIRC, the block lambda proposal covers this (pun might be intended)
> 
> window.foo = function() {
>   console.log("hi!");
> };
> 
> window.addEventListener('load', {||
>   this.foo(); // "hi!"
> }, false);
> 
> 
> http://wiki.ecmascript.org/doku.php?id=strawman:block_lambda_revival#semantics

-- 
Dr. Axel Rauschmayer
a...@rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com



_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to