f() = x de facto standard

Allen Wirfs-Brock allen at wirfs-brock.com
Wed Aug 7 09:21:28 PDT 2013


On Aug 7, 2013, at 4:08 AM, David Bruant wrote:

> Hi,
> 
> From http://qfox.nl/weblog/291
> Apparently, "f() = x" was forbidden as of ES5.1 (was still available in ES5 apparently), but a jQuery plugin is using it [1] (path not triggered in non-IE browsers).
> Not breaking the web, all that. It should probably be brought back.

I'm not sure where that analysis came from? As far as I know there were no such changes in ES5.1 and the ES5.1 grammar clearly allows a function call to appear on the LHS of an assignment.

That said, this is something we did discuss for ES6 and the current ES6 draft has a static semantic restriction that disallows assignment to the result of the function call.  In addition, functions are no longer allowed to return Reference values.  I don't see us changing the latter, so it comes down whether the error is reported as an early syntax error or a runtime TypeError.

> 
> Syntax isn't my cup of tea, so I'll let others judge if a detail was overlooked somewhere.
> 
> Kudos to @kuvos on this one!
> 
> David
> 
> [1] http://www.thuisbezorgd.nl/scripts/jquery/jquery.placeholder-min.js
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130807/27411115/attachment.html>


More information about the es-discuss mailing list