Michael O'Brien wrote:
> As a follow up, the following somewhat surprised me.
>
> {
> let b = 1
> {
> function fun() {
> print("CALL: " + b)
> }
> }
> }
> fun()
>
> gives:
>
> **ERROR** EvalError: uncaught exception: ReferenceError: unresolved
> lexical reference {multiname: [ns public '']::b [ns internal '']::b
> [ns public '__ES4__']::b } (near /Users/dherman/es4/src/builtins/
> Error.es:86:55-86.55)
>
>
> ie. the function is hoisted to the outer var block, but does not seem
> to capture the scope chain of where it was declared and b is out of
> scope.
>
> Is this correct or an RI bug?
This is incorrect and an RI bug, but for a different reason: fun should be
undefined in the outer scope, since it should not get hoisted out of the inner
block, as we agreed at the last face-to-face meeting.
Waldemar
_______________________________________________
Es4-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es4-discuss