Banning assignment to a function call

Oliver Hunt oliver at apple.com
Wed Jun 19 09:14:35 PDT 2013


I would be pro-killing this particular misfeature.  I know we have tests that verify that we accept the syntax, but i'm not sure if there's still *real* content the depends on it.

Does strict mode disallow it? IIRC strict mode has a blanket ban on non-reference lhs in assignment expressions but I don't have the spec handy.

--Oliver

On Jun 19, 2013, at 7:40 AM, Jason Orendorff <jason.orendorff at gmail.com> wrote:

> The program
> 
>     if (0) Math.sin(0) = 1;
>     alert("OK");
> 
> is permitted in all the major browsers. This was explicitly optional in ES1-5, but dropped from ES6:
> 
> https://github.com/rwldrn/tc39-notes/blob/master/es6/2012-11/nov-29.md#eliminate-functions-returning-reference-values-from-the-specification
> 
> And good riddance, if we really think implementations can drop support for this cursed-legacy syntax. I'm willing to experiment with making this an early ReferenceError in Firefox. But if anyone has tried and run into Web compatibility issues, please speak up and save me some wasted effort!
> 
> Thanks,
> -j
> _______________________________________________
> 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/20130619/67ed656f/attachment-0001.html>


More information about the es-discuss mailing list