const VS features detection

Andrea Giammarchi andrea.giammarchi at gmail.com
Wed Jan 8 10:39:31 PST 2014


I still need to think in terms of creating garbage ... being "unaware" of
optimizations behind the scene.

I like to believe compilers should help optimizing for me instead of me
developing to simplify compilers job so despite how complicated would be
behind the scene I meant a `do { try/catch }` while I need to write a
one-shot inline invoked function, needing to think about the context (arrow
simplifies this part) inner scope, strict behavior ... etc etc ... yet I
meant a `do { try/catch }` and/or an expression, not an invoke.

Once again, not a big deal: the arrow solves but it feels to me like a
little necessary hack.

Regards



On Wed, Jan 8, 2014 at 9:35 AM, François REMY <francois.remy.dev at outlook.com
> wrote:

> 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/24600978/attachment.html>


More information about the es-discuss mailing list