f() = x de facto standard
allen at wirfs-brock.com
Wed Aug 7 09:21:28 PDT 2013
On Aug 7, 2013, at 4:08 AM, David Bruant wrote:
> 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  (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!
>  http://www.thuisbezorgd.nl/scripts/jquery/jquery.placeholder-min.js
> es-discuss mailing list
> es-discuss at mozilla.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss