domenic at domenicdenicola.com (2014-01-14T17:45:37.573Z)
> Still bugs me by design we need to create garbage, including one-shot functions, in order to inline a try/catch to assign to a single "pointer" Please note that you do not really create a one-shot function and garbage in this case, at least if the compiler does his job well. The F# compiler, and probably many functional language compilers, would correctly inline the lambda function here. There’s probably no reason a JavaScript compiler couldn’t do the same here (and if this becomes a very used pattern, there will be traction to make sure this works well).
domenic at domenicdenicola.com (2014-01-14T17:45:10.953Z)
> Still bugs me by design we need to create garbage, including one-shot functions, in order to inline a try/catch to assign to a single "pointer"
Please note that you do not really create a one-shot function and garbage in this case, at least if the compiler does his job well. The F# compiler, and probably many functional language compilers, would correctly inline the lambda function here.
There’s probably no reason a JavaScript compiler couldn’t do the same here (and if this becomes a very used pattern, there will be traction to make sure this works well).
Still bugs me by design we need to create garbage, including one-shot functions, in order to inline a try/catch to assign to a single "pointer"
```javascript
const ES6_PROXY = ()=>{
try {
new Proxy({},{});
return true;
} catch(o_O) {
return false;
}
}();
```
Please note that you do not really create a one-shot function and garbage in this case, at least if the compiler does his job well. The F# compiler, and probably many functional language compilers, would correctly inline the lambda function here. There’s probably no reason a JavaScript compiler couldn’t do the same here (and if this becomes a very used pattern, there will be traction to make sure this works well). Still bugs me by design we need to create garbage, including one-shot functions, in order to inline a try/catch to assign to a single "pointer" ```javascript const ES6_PROXY = ()=>{ try { new Proxy({},{}); return true; } catch(o_O) { return false; } }(); ``` -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140108/bc2a7e59/attachment-0001.html>