Re: are there implementation reasons for not providing a break statement in an imperative language?

glen herrmannsfeldt <gah@ugcs.caltech.edu>
Tue, 8 Mar 2011 21:01:10 +0000 (UTC)

          From comp.compilers

Related articles
[8 earlier articles]
Re: are there implementation reasons for not providing a break stateme fusionfile@gmail.com (August Karlstrom) (2011-01-18)
Re: are there implementation reasons for not providing a break stateme richard@cogsci.ed.ac.uk (2011-01-19)
Re: are there implementation reasons for not providing a break stateme bc@freeuk.com (Bartc) (2011-01-20)
Re: are there implementation reasons for not providing a break stateme pdjpurchase@googlemail.com (1Z) (2011-02-13)
Re: are there implementation reasons for not providing a break stateme thomas.mertes@gmx.at (tm) (2011-02-17)
Re: are there implementation reasons for not providing a break stateme idbaxter@semdesigns.com (Ira Baxter) (2011-03-07)
Re: are there implementation reasons for not providing a break stateme gah@ugcs.caltech.edu (glen herrmannsfeldt) (2011-03-08)
Re: are there implementation reasons for not providing a break stateme robin51@dodo.com.au (robin) (2011-03-11)
| List of all articles for this month |

From: glen herrmannsfeldt <gah@ugcs.caltech.edu>
Newsgroups: comp.compilers
Date: Tue, 8 Mar 2011 21:01:10 +0000 (UTC)
Organization: A noiseless patient Spider
References: 11-01-043 11-02-011 11-03-028
Keywords: syntax, design
Posted-Date: 10 Mar 2011 23:12:30 EST

Ira Baxter <idbaxter@semdesigns.com> wrote:
(snip)


> Another alternative, much better IMHO, is labelled-block exits.
> Blocks may have labels. An exit <label> is allowed anywhere inside
> the block, and passes control to statement following the end. The
> above block would be recoded as:


> x: do {
> resource = getResource(counter);
> if (resource.isOk())
> exit x;
> releaseResource(resource);
> counter.increment();
> }


I suppose, but I am not sure it is any easier to read.


With GOTO, at least the statement you are looking for has the
specified label. In this case, when reading the code, first you have
to find the label x, then the end of the block that has that label.
For big blocks, that can be a lot of looking.


Now, many editors can find the } that matches a {, which helps
while in the editor, but not so much reading.


It does help with the "add a new block" later (that I snipped)
problem, but not much else.


-- glen



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.