Path: csiph.com!weretis.net!feeder4.news.weretis.net!news.mb-net.net!open-news-network.org!.POSTED!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.javascript Subject: Re: x === x Date: Wed, 31 May 2017 23:39:41 +0200 Organization: PointedEars Software (PES) Lines: 32 Message-ID: <2276977.Lt9SDvczpP@PointedEars.de> References: <874lw231ui.fsf@bsb.me.uk> <2872662.aeNJFYEL58@PointedEars.de> <87inkh28sf.fsf@bsb.me.uk> <19437984.EfDdHjke4D@PointedEars.de> <87efv4zr3k.fsf@bsb.me.uk> Reply-To: Thomas 'PointedEars' Lahn NNTP-Posting-Host: 47.229.197.178.dynamic.wless.zhbmb00p-cgnat.res.cust.swisscom.ch Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Trace: gwaiyur.mb-net.net 1496266782 28872 178.197.229.47 (31 May 2017 21:39:42 GMT) X-Complaints-To: abuse@open-news-network.org NNTP-Posting-Date: Wed, 31 May 2017 21:39:42 +0000 (UTC) User-Agent: KNode/4.14.2 X-Face: %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&. Thomas 'PointedEars' Lahn writes: >> | > {} === {} >> | <- false >> | {} === {}; >> | (x) Uncaught SyntaxError: Unexpected token === >> >> I assume that the explicit semicolon there is considered an >> /EmptyStatement/ that switches back to statement context. > > I can't find any reference to "statement context" or "expression > context" in the language standard. I assume it's your own terminology, > but I don't see how it helps explain why [] === []; is OK but {} === {}; > is a syntax error. (I know why, I'm just wondering how talking about > === making expression context and ; switching back helps to explain this > difference.) Simply put, ECMAScript syntax is ambiguous, and it depends on the context how it is parsed. For example, “{}” can be parsed either as an empty /Block/ *statement* (which can only be produced by the /Statement/ production) or as an empty Object initializer; the latter is an *expression* (it can only be produced by the /Expression/ production). A further complication is the /ExpressionStatement/ production (IIRC). I will consider the rest of your posting later. -- PointedEars FAQ: | | Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.