Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!news1.tnib.de!feed.news.tnib.de!news.tnib.de!news.belwue.de!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="ISO-8859-1" Message-ID: <1367331.WGnKmheAe9@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Wed, 28 Dec 2011 19:10:19 +0100 User-Agent: KNode/4.4.11 Content-Transfer-Encoding: 7Bit Subject: Re: Simulate goto Newsgroups: comp.lang.javascript References: <4ef9a823$0$6842$e4fe514c@news2.news.xs4all.nl> <1931071.aqSPkdTlGX@PointedEars.de> Followup-To: comp.lang.javascript MIME-Version: 1.0 Lines: 50 NNTP-Posting-Date: 28 Dec 2011 19:10:19 CET NNTP-Posting-Host: b8a6ae0f.newsspool3.arcor-online.net X-Trace: DXC=8Z8B2C1jIUdUoRk[hk2WalMcF=Q^Z^V3h4Fo<]lROoRa8kF Thomas 'PointedEars' Lahn wrote: >> Tom de Neef wrote: >>> The error may have more to do with 'continue' than with the label. >>> Check where you can use a continue statement - I think it is restricted >>> to for- and while- loops. >> You are mistaken. The `continue' statement, like the Labelled Statement >> is just another /Statement/, and it can be located anywhere in a >> /Program/: > > Now look at section 12.7 of ECMAScript 262, 5.1 Edition, at the text > following > "A program is considered syntactically incorrect if either of > the following is true:" > which disagrees with you. No, but it disagrees with the implications of my statement regarding this problem. A `continue' statement *can* be located anywhere in a /Program/. However, there are restrictions as to location of the label that may be referred by the optional /Identifier/. AIUI, it should be possible to use an enclosing /Statement/ (like a /Block/ statement) and a `break' statement here (section 12.8): function testGoto() { var isFirst = true; if (true) { skipPoint: window.alert("Using goto\n"); if (isFirst) { isFirst = false; break skipPoint; window.alert("This part is skipped"); } } } However, Google V8 3.5.10.9+ in Chromium 15.0.874.121 (Developer Build 109964 Linux) considers that a syntax error as well (same error message: "SyntaxError: Undefined label 'skipPoint'"). Is this a bug? PointedEars -- When all you know is jQuery, every problem looks $(olvable).