On Sun, May 9, 2010 at 2:52 PM, Gmail Dev <[email protected]> wrote:

> On May 9, 2010, at 10:50 AM, "Mark S. Miller" <[email protected]> wrote:
> [...]
>
>
> * Const Functions: 
> <<http://wiki.ecmascript.org/doku.php?id=strawman:const_functions>
> http://wiki.ecmascript.org/doku.php?id=strawman:const_functions>
>
>
> The case with const function expressions is a bit unclear.
>
> What happens when:
>
> var f = const g(){
>    function g(){};
> };
>
> Is f writable in this case but g isn't?
>

Yes. f is also visible in the containing scope. g is only visible within the
function (or would be if it weren't shadowed).


> Would executing f throw error due to redeclaration of g?
>

If I read the ES5 spec correctly, in the following code the declaration of g
in the function body shadows the g declared by the function expression
rather than redeclaring it. const should likewise shadow rather than error,
as implied by the expansion shown on the strawman page.

  var f = function g(){
     function g(){};
  };




>
> --
> kangax
>



-- 
    Cheers,
    --MarkM
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to