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
[email protected]
home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss