{"action":"created","issue":{"url":"https://api.github.com/repos/tc39/ecma262/issues/260","labels_url":"https://api.github.com/repos/tc39/ecma262/issues/260/labels{/name}","comments_url":"https://api.github.com/repos/tc39/ecma262/issues/260/comments","events_url":"https://api.github.com/repos/tc39/ecma262/issues/260/events","html_url":"https://github.com/tc39/ecma262/issues/260","id":122459496,"number":260,"title":"dropping for-in initializers was sufficiently incompatible as to be reverted by browsers","user":{"login":"saurik","id":36743,"avatar_url":"https://avatars.githubusercontent.com/u/36743?v=3","gravatar_id":"","url":"https://api.github.com/users/saurik","html_url":"https://github.com/saurik","followers_url":"https://api.github.com/users/saurik/followers","following_url":"https://api.github.com/users/saurik/following{/other_user}","gists_url":"https://api.github.com/users/saurik/gists{/gist_id}","starred_url":"https://api.github.com/users/saurik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saurik/subscriptions","organizations_url":"https://api.github.com/users/saurik/orgs","repos_url":"https://api.github.com/users/saurik/repos","events_url":"https://api.github.com/users/saurik/events{/privacy}","received_events_url":"https://api.github.com/users/saurik/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-12-16T09:12:34Z","updated_at":"2015-12-18T01:55:37Z","closed_at":null,"body":"I was having a discussion with @wycats, and he said that if the spec said to do something that all the major browsers refused to do, that it should be filed as a bug against the spec; he encouraged me to actually file this one as a pull request, but I did not feel entirely qualified to decide the next step.\r\n\r\nAll of V8, JavaScriptCore, and SpiderMonkey have found themselves unable to honor the ECMAScript 2015 requirement that \"for (var x = 0 in []);\" is a SyntaxError (which is documented in Annex E 13.7). Here is what I've been able to dig up about this situation, with links to online bug trackers as appropriate.\r\n\r\nTo begin with, the text \"The value of that expression was always discarded.\" is actually incorrect: the code has in fact *always* been executed as a side effect until a few months ago, and even the value was quite visible in that it \"initialized\" the variable: note the behavior with respect to iterating an empty array.\r\n\r\n```\r\nV8 version 2.2.23\r\n> for (var i = 0 in []); i\r\n0\r\n```\r\n\r\nMeanwhile, when this was discussed for compatibility impact a while ago, running a regex against a web crawl showed that the syntax was being used by a number of websites... and the regular expression was flawed in a way (checking only for one character variable names) that underestimates the usage.\r\n\r\nhttps://bugzilla.mozilla.org/show_bug.cgi?id=748550\r\n\r\nFinally, when this was actually deployed in real-world browsers, it failed: people complained about code not working any longer, and the change was reverted, first in JavaScriptCore, and then in SpiderMonkey. I am not certain if V8 ever shipped the change, but the code currently includes a workaround for this.\r\n\r\nhttps://bugs.webkit.org/show_bug.cgi?id=130269\r\nhttps://bugzilla.mozilla.org/show_bug.cgi?id=1164741\r\n\r\nhttps://chromium.googlesource.com/v8/v8.git/+/0e052bb8346d23627d1cfed43b4dc8bdf1a734d2/src/parsing/parser.cc#3740\r\n\r\nFWIW, my personal idea would be to include the following extra production, which adds the most minimal amount of extra support for this feature to the grammar as is possible in order to make it work. I also believe that the result should not be discarded, as otherwise it breaks old initialization logic.\r\n\r\n    IterationStatement[Yield,Return]:\r\n        for ( var BindingIdentifier[?Yield] Initializer[?Yield] in Expression[In,?Yield] ) Statement[?Yield, ?Return]"},"comment":{"url":"https://api.github.com/repos/tc39/ecma262/issues/comments/165637510","html_url":"https://github.com/tc39/ecma262/issues/260#issuecomment-165637510","issue_url":"https://api.github.com/repos/tc39/ecma262/issues/260","id":165637510,"user":{"login":"bterlson","id":11236,"avatar_url":"https://avatars.githubusercontent.com/u/11236?v=3","gravatar_id":"","url":"https://api.github.com/users/bterlson","html_url":"https://github.com/bterlson","followers_url":"https://api.github.com/users/bterlson/followers","following_url":"https://api.github.com/users/bterlson/following{/other_user}","gists_url":"https://api.github.com/users/bterlson/gists{/gist_id}","starred_url":"https://api.github.com/users/bterlson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bterlson/subscriptions","organizations_url":"https://api.github.com/users/bterlson/orgs","repos_url":"https://api.github.com/users/bterlson/repos","events_url":"https://api.github.com/users/bterlson/events{/privacy}","received_events_url":"https://api.github.com/users/bterlson/received_events","type":"User","site_admin":false},"created_at":"2015-12-18T01:55:37Z","updated_at":"2015-12-18T01:55:37Z","body":"We also do not get away with this. I will present this at the next TC39 to get consensus for what goes in Annex B. Essentially it seems like we do have evidence that we could get away with ignoring this syntax if we wanted, but it's not clear that's what we want if that's all we can do."}}