evaling anonymous function declarations

Geoffrey Garen ggaren at apple.com
Fri Jun 12 19:30:44 PDT 2009


> Thanks for testing, I had forgotten about our bold attempt to break  
> this old extension and comply with ES3. Unless this is about to be  
> fixed in WebKit, I agree we can stand on ES3 precedent.

WebKit changed a few revisions ago to make eval(“function () {};”) a  
syntax error. Prior to that, WebKit would return a function object.

I don't think any specific website motivated the change; we just  
wanted to match ES3, Firefox, and (sort of) IE.

The change didn't produce any significant website compatibility  
problems. It did, however, drive WebKit application authors completely  
nuts. So, at least a few developers would be happy to see ES5 specify  
that eval(“function () {};”) returned a function object.

I don't have a strong opinion either way. WebKit's current plan is to  
continue throwing a syntax error, and let sleeping dogs lie.

Geoff


More information about the es5-discuss mailing list