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

liorean liorean at gmail.com
Sat Aug 4 12:19:19 PDT 2007


On 04/08/07, Shijun He <hax.sfo at gmail.com> wrote:
> On 7/27/07, liorean <liorean at gmail.com> wrote:
> > Functions with different scope may be joined, but only if the scope
> > difference will lead to no externally observable difference.
>
> I would like to say my opinion again: though your words is very
> reasonable, and I believe that may be the original meaning of the
> authors of es3, but I can't read it from the specification. The spec
> only say if there is no observable diff, then the impl could not only
> join them but also use the same object at all.

You're right, the specification doesn't say it outright. The
specification is made for implementators though. The implementing
joined functions for *more* than the special case of when the
difference is not externally observable is not possible without
breaking the semantics of the scoping and closure mechanisms of the
language.

In fact, even joined functions for the special case of no externally
observable differences is tricky - if "externally observable" only
refers to variable scoping, then certain valid ES3 programs *will*
have ambiguous semantics - those programs that use global objects or
the joined function object itself as storage. Both Neil Mix and Lars T
Hansen gave examples which show the ambiguity of the language due to
allowing joined function objects even in the case of only doing them
for the case of no externally observable differences.

> You know english is not my native language, so may be I misunderstand it.

No, you don't misunderstand it. I just read more between the lines than you do.
-- 
David "liorean" Andersson



More information about the Es4-discuss mailing list