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

P T Withington ptw at pobox.com
Tue Jul 31 05:41:05 PDT 2007


On 2007-07-31, at 07:52 EDT, Lars T Hansen wrote:

> On 7/30/07, P T Withington <ptw at pobox.com> wrote:
>
>> So, what the spec meant to say is:  If the compiler writer can think
>> of an optimization that will save time or space and not break the
>> semantics of Javascript, they are permitted to make that
>> optimization. :)
>
> Joining is more sinister than that and several messages in this thread
> have approached the problem from various angles.  The worst of it is
> that side effects on function objects are unpredictable, as Neil Mix
> wrote earlier.

Indeed.  I was suggesting that the spec was broken; that it meant to  
prescribe an optimization to avoid unnecessary closures, but that it  
got it wrong (perhaps because it overlooked the mutability of the  
function object itself?).  Surely backwards compatibility should not  
trump correctness?  You don't want to have to force users to contrive  
to create a closure just to be able to add properties to a function?

Oh.  Ha, ha.  Now I understand a piece of code in our runtime that  
did exactly that (since removed).  I think the test case you are  
looking for might be the SWF version 5 interpreter.



More information about the Es4-discuss mailing list