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

liorean liorean at
Fri Jul 27 02:02:21 PDT 2007

On 26/07/07, Neil Mix <nmix at> wrote:
> Wait, am I following this correctly in that:
> var x = A();
> var y = A();
> = 1;
> = 2;
> alert( +;
> 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.

Yes, you're following it correctly. Yes, this feature of the spec is
"buggy", in the sense that you have two incompatible behaviours that
are both correct according to the spec. So in a way, we're fortunate
the most wide spread engines don't use joined function objects.

On 27/07/07, Shijun He <hax.sfo at> wrote:
> 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.

x()===y() may return false the same way x()===x() may return false.
Functions in JavaScript may have side effects, and the same input
doesn't necessarily give the same output in cosecutive uses of the

Functions with different scope may be joined, but only if the scope
difference will lead to no externally observable difference. For

    function mkFn(x){
        return function fn(y){
            return y*y;

The variable x in mkFn will give no externally observable difference
in fn1 and fn2, thus fn1 and fn2 may be joined. If fn did use x
however, they couldn't be joined because then that would lead to an
externally observable difference.
David "liorean" Andersson

More information about the Es4-discuss mailing list