const VS features detection

François REMY francois.remy.dev at outlook.com
Wed Jan 8 09:35:52 PST 2014


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>


More information about the es-discuss mailing list