On Sat, Jun 14, 2008 at 11:43 PM, Garrett Smith <[EMAIL PROTECTED]> wrote:
> The spec doesn't mention that FunctionExpression with Identifier can
> affect scope chain. Example:-
>
> (function f() {
>  var propertyIsEnumerable = 0;
>  (function f() {
>        alert(propertyIsEnumerable); //=> native code
>  })();
> })();


Hi Garrett, thanks for alerting us to this bizarre behavior. I had no
idea. I did reproduce this behavior and minor variants. However,
oether variants didn't work, indicating that I don't yet understand
what's happening here. For example, on Firefox 2.0.0.14 in squarefree:

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

    g()
    ReferenceError on line 1: x is not defined

    g.x = 3;
    3

    g()
    ReferenceError on line 1: x is not defined

As I thought I understood this example, I would have expected the last
call to g() to return 3. Can someone explain why it doesn't?

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

Reply via email to