While this compiles in the RI, it still produces 2 and 2 for the output.

ie. doesn't seem they are block scoped functions either.

Michael

John Resig wrote:
> I was under the impression that for the function definitions to be confined 
> to a block scope, you had to define them as such (with let function 
> statements), like so:
>
> package {
>     {
>         let function fun() {
>             print("1");
>         }
>         fun()
>     }
>     {
>         let function fun() {
>             print("2")
>         }
>         fun()
>     }
> }
>
> I'm unsure if this currently works in the RI, or not.
>
> --John
>
>
> ----- Original Message -----
> From: "Michael O'Brien" <[EMAIL PROTECTED]>
> To: "es4-discuss" <es4-discuss@mozilla.org>
> Sent: Thursday, December 13, 2007 7:10:41 PM (GMT-0500) America/New_York
> Subject: Global functions 
>
> Are global functions declared with block or global scope. ie. declared 
> in the block object or var object?
>
> Consider:
>
> package {
>     {
>         function fun() {
>             print("1");
>         }
>         fun()
>     }
>     {
>         function fun() {
>             print("2")
>         }
>         fun()
>     }
> }
>
>
> This prints
>
> 2
> 2
>
> in the RI.
>
> So should functions be treated like var declarations or as let 
> declarations. Seems like they are like vars in the RI.
>
> Is this right?
>
> Michael O'Brien
>
> _______________________________________________
> Es4-discuss mailing list
> Es4-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es4-discuss
>
>
>   
_______________________________________________
Es4-discuss mailing list
Es4-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es4-discuss

Reply via email to