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;
}
}();
```
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss