Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!fu-berlin.de!uni-berlin.de!not-for-mail From: Jake Jarvis Newsgroups: comp.lang.javascript Subject: Re: Simulate goto Date: Wed, 28 Dec 2011 23:18:22 +0100 Lines: 55 Message-ID: <9m1iteFodiU1@mid.uni-berlin.de> References: <4ef9a823$0$6842$e4fe514c@news2.news.xs4all.nl> <1931071.aqSPkdTlGX@PointedEars.de> <1367331.WGnKmheAe9@PointedEars.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de LPu71Xl1VOsNxZmF8AsDDgT2cl8QjjH2h68UMtSM7MwFTgiO4= User-Agent: Mozilla/5.0 (X11; Linux i686; rv:8.0) Gecko/20111124 Thunderbird/8.0 In-Reply-To: <1367331.WGnKmheAe9@PointedEars.de> Xref: x330-a1.tempe.blueboxinc.net comp.lang.javascript:9744 On 28.12.2011 19:10, Thomas 'PointedEars' Lahn wrote: > John G Harris wrote: > >> 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? > No. Why should it work? I think there is slight confusion as to what it means for a statement to be 'enclosing' another. -- Jake Jarvis