On Sep 25, 2009, at 11:28 AM, Brendan Eich wrote:

 function compile(...) {
   eval("var f = function() {" + compile_optimized_query(); + "}");

(Stray ; there in the + chain, oops.)


   return f;
 }

This can be avoided by putting the var f = outside the eval, if you parenthesize the lambda of course -- except Jack Slocum pointed out to me that IE has bugs (perhaps only old IE versions still have these) that bite this alternative! I'm not sure what the latest extjs code does, since it seems hidden by dual licensing stuff I didn't click through.

I did raise this issue in the course of strict mode's evolution, while corresponding with Jack. I'm sorry I didn't follow up on it, although the results may not have changed. Even if Microsoft fixes bad old lambda bugs in JScript (glad to hear from Allen that it will in some configuration or opt-in setting), old IE versions, and not-opted-in scripts, will see the bugs and need the kind of structure Jack had to use to compile optimized query functions.

Again, perhaps extjs has found another way. If not, it may be impossible for the compiler function to be strict. But the ES5 strict mode design may take that hit for some hoped-for greater good.


Given our inability to avoid runtime errors new with strict mode, we managed to reach consensus on a few further runtime semantic changes. If these cause trouble, we may find fewer strict mode uses than we'd like to find. But it's hard to evaluate strict mode adoption for success or failure based on whether these runtime changes bite back -- we can't run the experiment a different way.

But we can hear feedback, esp. on this list, about hardship adopting strict mode in early ES5 implementations. Mozilla's will be done shortly, and it sounds like WebKit's is coming along quickly too. Feedback based on two interoperable implementations in developers' hands before the ES5 spec is stamped done would have been best. But real-code/real-world feedback better late than never is welcome.

/be

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to