Question about joined function object of ECMA-262 3rd edition

Shijun He hax.sfo at gmail.com
Thu Jul 26 23:33:22 PDT 2007


On 7/27/07, Neil Mix <nmix at pandora.com> wrote:
> Wait, am I following this correctly in that:
>
> function A() {
>        function B() {}
>        return B;
> }
>
> var x = A();
> var y = A();
>
> x.foo = 1;
> y.foo = 2;
>
> alert(x.foo + y.foo);
>
> would show "3" in current compliant implementations, but
> theoretically in the future an implementation could exist that would
> show "4" and *still be compliant*?  If I'm surmising correctly, then
> that seems...buggy.
>

That's why I am confused...

Moreover, the spec says (13.1.2):

NOTE Two or more objects joined to each other are effectively
indistinguishable except that they may have different internal
properties. The only such internal property that may differ in this
specification is [[Scope]].

As I understand, that means, if x and y are joined, then:
x === y returns true, but
x() == y() may return false, because their [[Scope]] may differ.



More information about the Es4-discuss mailing list