Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.chainon-marquant.org!nntpfeed.proxad.net!proxad.net!feeder1-1.proxad.net!217.188.199.168.MISMATCH!takemy.news.telefonica.de!telefonica.de!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="UTF-8" Message-ID: <2061055.5TFfkVmt2V@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Thu, 29 Dec 2011 17:47:58 +0100 User-Agent: KNode/4.4.11 Content-Transfer-Encoding: 8Bit Subject: Re: Simulate goto Newsgroups: comp.lang.javascript References: <4ef9a823$0$6842$e4fe514c@news2.news.xs4all.nl> <1931071.aqSPkdTlGX@PointedEars.de> <1367331.WGnKmheAe9@PointedEars.de> <9m1iteFodiU1@mid.uni-berlin.de> <1932615.aqSPkdTlGX@PointedEars.de> Followup-To: comp.lang.javascript MIME-Version: 1.0 Lines: 64 NNTP-Posting-Date: 29 Dec 2011 17:47:58 CET NNTP-Posting-Host: c36c0381.newsspool1.arcor-online.net X-Trace: DXC=gSb Thomas 'PointedEars' Lahn wrote: >> function testGoto() >> { >> var counter = 0; >> >> skipPoint: >> { >> window.alert(counter); >> >> if (counter === 0) >> { >> ++counter; >> break skipPoint; >> window.alert("This part is skipped"); >> } >> } >> } > > > > There is no IterationStatement in the function. That is irrelevant as I am _not_ using the `continue' statement. > 'skipPoint' doesn't label an IterationStatement. Therefore, also irrelevant. > The break statement contains an Identifier. Correct. > The break statement is not contained in any IterationStatement. Irrelevant. If you read section 12.8 (instead of section 12.7), you will observe that the labelled statement that can be used with the `break' statement is governed by other rules than that for a `continue' statement: A labelled /Statement/ suffices. The /Block/ statement (`{…}') is such a /Statement/ (see the grammar productions posted before). > When you test these facts with the horribly written text in > section 12.7 : > "The program contains a continue statement with the optional > Identifier, where Identifier does not appear in the label set of > an enclosing (but not crossing function boundaries) > IterationStatement" > then you can only conclude that the program fragment contains a syntax > error. No, because it does _not_ contain a `continue' statement, but a `break' statement. > [snip further misconceptions] Please learn to read. Google V8 parses the source code (as the function above is declared) and evaluates the above /Program/ (as the function above is called) to the letter of the standard here. PointedEars -- When all you know is jQuery, every problem looks $(olvable).