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

August Karlstrom <fusionfile@gmail.com>
Fri, 14 Jan 2011 17:14:18 +0100

          From comp.compilers

Related articles
are there implementation reasons for not providing a break statement i noitalmost@cox.net (noitalmost) (2011-01-13)
Re: are there implementation reasons for not providing a break stateme DrDiettrich1@aol.com (Hans-Peter Diettrich) (2011-01-14)
Re: are there implementation reasons for not providing a break stateme fusionfile@gmail.com (August Karlstrom) (2011-01-14)
Re: are there implementation reasons for not providing a break stateme anton@mips.complang.tuwien.ac.at (2011-01-15)
Re: are there implementation reasons for not providing a break stateme bc@freeuk.com (BartC) (2011-01-16)
Re: are there implementation reasons for not providing a break stateme Pidgeot18@verizon.net (Joshua Cranmer) (2011-01-16)
Re: are there implementation reasons for not providing a break stateme richard@cogsci.ed.ac.uk (2011-01-18)
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 fusionfile@gmail.com (August Karlstrom) (2011-01-18)
[7 later articles]
| List of all articles for this month |
From: August Karlstrom <fusionfile@gmail.com>
Newsgroups: comp.compilers
Date: Fri, 14 Jan 2011 17:14:18 +0100
Organization: A noiseless patient Spider
References: 11-01-043
Keywords: design, syntax
Posted-Date: 15 Jan 2011 00:27:36 EST

On 2011-01-13 19:09, noitalmost wrote:
> I've noticed that Wirth has continually rejected the idea of a break
> statement and I was wonder why. Is this purely philosophical, or are
> there code optimization reasons? Naive code for a break is trivial to
> implement.


With no break statements you will know that the loop condition will be
false when the loop has finished. This makes it easier to reason about
the correctness of a program.


Here is a quote from the article "Differences between Oberon-07 and
Oberon" by N. Wirth:


"It had been thought that the while statement with the termination
condition at its entry, and the repeat statement with the termination
condition at its end must be amended by a general and flexible construct
with termination conditions anywhere. The loop statement with its exit
statements represents, however, a break with the idea of a structured
language, where properties of a statement can be derived from those of
its components. The loop statement with its syntactically unconnected
exit statements does not allow this. It has therefore been deleted from
the language together with the associated exit statement."


http://www.inf.ethz.ch/personal/wirth/Articles/Oberon/Oberon07.pdf


> Is it easier to optimize loops with no break?


Not as far as I know.




/August
--
The competent programmer is fully aware of the limited size of his own
skull. He therefore approaches his task with full humility, and avoids
clever tricks like the plague. --Edsger Dijkstra


Post a followup to this message

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