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
Return to the
comp.compilers page.
Search the
comp.compilers archives again.