On Tue 20 Mar 2012 21:13, Allen Wirfs-Brock <al...@wirfs-brock.com> writes:

> On Mar 20, 2012, at 8:55 AM, Andy Wingo wrote:
>
>     On Tue 20 Mar 2012 16:45, Andy Wingo <wi...@igalia.com> writes:
>
> Your original post doesn't seem to have made it to the discussion list. 

Odd.  Here's the meat:

    Const is just a bit strange.  For example:

      (function (){
         baz = 20;
         return baz;
         const baz = 30;
         baz = 40;
         baz = 50;
       })()
       => 20

    Or:

      (function (){
         return function(x) { baz = x; return function() { return baz; } };
         const baz = 30;
       })(20)()
       => 20

    I don't really get the point of const, to be honest.  It doesn't help
    implementors, because the compiler already knows if a variable is
    assigned more than once.

    It doesn't seem to help programmers, because the delayed initialization
    with temporal dead zone means that you might have to do just as much
    mental work to figure out what sets a const var as before.  Seeing
    "const baz;" is pretty strange.

    Ignorant suggestion: either disallow assignment to const variables
    outside an initializer, or remove const from the language.

> bugs.ecmasript.org is probably a better place for reporting these shorts of 
> issues.

OK, thanks.

Regards,

Andy
-- 
http://wingolog.org/
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to