<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Just to remind you, that there exists a
nice prettyprinter written by G. Feldmann, running on ETHOberon
Windows plugin.<br>
Regards,<br>
Dieter<br>
<br>
Am 25.07.2017 um 01:44 schrieb Hans Klaver:<br>
</div>
<blockquote cite="mid:460CD172-6973-430C-8EEE-4AED475DD284@dds.nl"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
Jörg wrote:
<div class=""><br class="">
<div>
<blockquote type="cite" class="">
<div class=""><span style="font-family: Menlo-Regular;
font-size: 13px; font-style: normal; font-variant-caps:
normal; font-weight: normal; letter-spacing: normal;
text-align: start; text-indent: 0px; text-transform:
none; white-space: normal; word-spacing: 0px;
-webkit-text-stroke-width: 0px; float: none; display:
inline !important;" class="">Indentation is indeed a
totally personal thing.</span><br style="font-family:
Menlo-Regular; font-size: 13px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;"
class="">
</div>
</blockquote>
<br class="">
</div>
<div>It is interesting to catalogue the different indentation
styles used by some well known (and less well known)
programmers of Oberon and Component Pascal source code. With
one of the exercises of the Reiser & Wirth book as
material I wrote out various indentation styles.
<div class=""><br class="">
</div>
<div class="">Crudely four styles of indentation can be
discerned:</div>
<div class="">- No indentation (Daniel)</div>
<div class="">- Minimal indentation (Reiser / Mössenböck); the
difference between the two is in the indentation of
declarations (e.g. VAR) at the procedure level</div>
<div class="">- Classical indentation (Wirth & Gutknecht);
has the most consistent indentation of scope levels.</div>
<div class="">- Knuth indentation (Knuth / Campbell); also
quite consistent, but rather convoluted.<br class="">
<div><br class="">
</div>
<div><br class="">
</div>
<div>
<div>MODULE M; (* After Exercise 6.4 (p. 85) from Reiser
& Wirth, Programming in Oberon *)</div>
<div>IMPORT Out;</div>
<div>VAR i, j: INTEGER;</div>
<div>PROCEDURE A*;</div>
<div>VAR i: INTEGER;</div>
<div>PROCEDURE B(VAR i, j: INTEGER);</div>
<div>VAR k: INTEGER;</div>
<div>BEGIN k := i; i := j; j := k END B;</div>
<div>BEGIN i := 2; B(i, j)</div>
<div>END A;</div>
<div>PROCEDURE C*;</div>
<div>BEGIN A; i := 2*j; </div>
<div>Out.Int(i, 5); Out.Int(j, 5); Out.Ln</div>
<div>END C;</div>
<div>BEGIN</div>
<div>END M.C</div>
<div><br class="">
</div>
<div>(**************************************)</div>
<div><br class="">
</div>
<div>MODULE M; (* Daniel, <a moz-do-not-send="true"
href="http://www.waltzballs.org/other/prog.html#track"
class="">http://www.waltzballs.org/other/prog.html#track</a> *)</div>
<div>IMPORT Out;</div>
<div>VAR i,j:INTEGER;</div>
<div><br class="">
</div>
<div>PROCEDURE A*;</div>
<div>VAR i:INTEGER;</div>
<div><br class="">
</div>
<div>PROCEDURE B(VAR i,j:INTEGER);</div>
<div>VAR k:INTEGER;</div>
<div>BEGIN k:=i;i:=j;j:=kEND B;</div>
<div><br class="">
</div>
<div>BEGIN i:=2;B(i,j)</div>
<div>END A;</div>
<div><br class="">
</div>
<div>PROCEDURE C*;</div>
<div>BEGIN A;i:=2*j; </div>
<div>Out.Int(i,5);Out.Int(j,5);Out.Ln</div>
<div>END C;</div>
<div><br class="">
</div>
<div>BEGIN</div>
<div>END M.C</div>
<div><br class="">
</div>
<div>(**************************************)</div>
<div><br class="">
</div>
<div>MODULE M; (* M. Reiser, The Oberon System </div>
<div> and M. Reiser & N. Wirth, Programming in
Oberon *)</div>
<div>IMPORT Out;</div>
<div>VAR i, j: INTEGER; </div>
<div><br class="">
</div>
<div>PROCEDURE A*;</div>
<div>VAR i: INTEGER;</div>
<div><br class="">
</div>
<div> PROCEDURE B(VAR i, j: INTEGER);</div>
<div> VAR k: INTEGER;</div>
<div> BEGIN </div>
<div> k := i; i := j; j := k </div>
<div> END B;</div>
<div><br class="">
</div>
<div>BEGIN </div>
<div> i := 2; B(i, j)</div>
<div>END A;</div>
<div><br class="">
</div>
<div>PROCEDURE C*;</div>
<div>BEGIN </div>
<div> A; i := 2*j; </div>
<div> Out.Int(i, 5); Out.Int(j, 5); Out.Ln</div>
<div>END C;</div>
<div><br class="">
</div>
<div>BEGIN</div>
<div>END M.C</div>
<div><br class="">
</div>
<div>(*************************************)</div>
<div><br class="">
</div>
<div>MODULE M; (* H. Mössenböck, Object Oriented
Programming in Oberon-2 *)</div>
<div>IMPORT Out;</div>
<div>VAR i, j: INTEGER;</div>
<div><br class="">
</div>
<div>PROCEDURE A*;</div>
<div> VAR i: INTEGER;</div>
<div><br class="">
</div>
<div> PROCEDURE B(VAR i, j: INTEGER);</div>
<div> VAR k: INTEGER;</div>
<div> BEGIN </div>
<div> k := i; i := j; j := k </div>
<div> END B;</div>
<div><br class="">
</div>
<div>BEGIN </div>
<div> i := 2; B(i, j)</div>
<div>END A;</div>
<div><br class="">
</div>
<div>PROCEDURE C*;</div>
<div>BEGIN </div>
<div> A; i := 2*j; </div>
<div> Out.Int(i, 5); Out.Int(j, 5); Out.Ln</div>
<div>END C;</div>
<div><br class="">
</div>
<div>BEGIN</div>
<div>END M.C</div>
<div><br class="">
</div>
<div>(**************************************)</div>
<div><br class="">
</div>
<div>MODULE M; (* Wirth & Gutknecht, Project Oberon
*)</div>
<div> IMPORT Out;</div>
<div> VAR i, j: INTEGER;</div>
<div><br class="">
</div>
<div> PROCEDURE A*;</div>
<div> VAR i: INTEGER;</div>
<div><br class="">
</div>
<div> PROCEDURE B(VAR i, j: INTEGER);</div>
<div> VAR k: INTEGER;</div>
<div> BEGIN </div>
<div> k := i; i := j; j := k </div>
<div> END B;</div>
<div><br class="">
</div>
<div> BEGIN </div>
<div> i := 2; B(i, j)</div>
<div> END A;</div>
<div><br class="">
</div>
<div> PROCEDURE C*;</div>
<div> BEGIN </div>
<div> A; i := 2*j; </div>
<div> Out.Int(i, 5); Out.Int(j, 5); Out.Ln</div>
<div> END C;</div>
<div><br class="">
</div>
<div>BEGIN</div>
<div>END M.C</div>
<div><br class="">
</div>
<div>(**************************************)</div>
<div><br class="">
</div>
<div>MODULE M; (* Knuth. E.g. see: <a
moz-do-not-send="true"
href="http://brokestream.com/tex.pdf" class="">http://brokestream.com/tex.pdf</a> *)</div>
<div> IMPORT Out;</div>
<div> VAR i, j: INTEGER;</div>
<div><br class="">
</div>
<div> PROCEDURE A*;</div>
<div> VAR i: INTEGER;</div>
<div><br class="">
</div>
<div> PROCEDURE B(VAR i, j: INTEGER);</div>
<div> VAR k: INTEGER;</div>
<div> BEGIN k := i; i := j; j := k </div>
<div> END B;</div>
<div><br class="">
</div>
<div> BEGIN i := 2; B(i, j)</div>
<div> END A;</div>
<div><br class="">
</div>
<div> PROCEDURE C*;</div>
<div> BEGIN A; i := 2*j; </div>
<div> Out.Int(i, 5); Out.Int(j, 5); Out.Ln</div>
<div> END C;</div>
<div><br class="">
</div>
<div> BEGIN</div>
<div> END M.C</div>
<div><br class="">
</div>
<div>(**************************************)</div>
<div><br class="">
</div>
<div>
<div>MODULE M; (* R. Campbell, Subsystem Lib for
BlackBox Component Framework, </div>
<div> see the Component Pascal Collection, <a
moz-do-not-send="true"
href="http://www.zinnamturm.eu/" class="">http://www.zinnamturm.eu/</a> *)</div>
<div>IMPORT Out;</div>
<div>VAR </div>
<div> i, j : INTEGER;</div>
<div><br class="">
</div>
<div>PROCEDURE A*;</div>
<div> VAR </div>
<div> i : INTEGER;</div>
<div><br class="">
</div>
<div> PROCEDURE B(VAR i, j : INTEGER);</div>
<div> VAR </div>
<div> k : INTEGER;</div>
<div> BEGIN </div>
<div> k := i; i := j; j := k </div>
<div> END B;</div>
<div><br class="">
</div>
<div> BEGIN </div>
<div> i := 2; </div>
<div> B(i, j)</div>
<div> END A;</div>
<div><br class="">
</div>
<div>PROCEDURE C*;</div>
<div> BEGIN </div>
<div> A; </div>
<div> i := 2*j; </div>
<div> Out.Int(i, 5); Out.Int(j, 5); Out.Ln</div>
<div> END C;</div>
<div><br class="">
</div>
<div>BEGIN</div>
<div>END M.C</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">Anyone can choose his or her favourite
indentation style.</div>
<div class=""><br class="">
</div>
<div class="">I personally don't like the two extremes
(Daniel and Knuth / Campbell). Imho they don't follow
Einstein's criterium "Make it as simple as ...":
Daniel's is too simplistic and Knuth's / Campbell's
are too convoluted.</div>
<div class=""><br class="">
</div>
<div class="">The classic Wirth / Gutknecht style is the
only style that is completely consistent: every scope
has its own indentation.</div>
<div class="">BlackBox uses this style as standard.
See: <a moz-do-not-send="true"
href="https://hansklav.home.xs4all.nl/ProgrammingConventionsBB.pdf"
class="">https://hansklav.home.xs4all.nl/ProgrammingConventionsBB.pdf</a></div>
<div class=""><br class="">
</div>
<div class="">Some might find the Reiser / Mössenböck
styles more aesthetically pleasing because of their
simplicity. Although these styles are not as
consistent as the Wirth / Gutknecht style, in practice
this doesn't matter much because there is only one
module scope per compilation unit, and nested
procedures are rarely used in Oberon programs.</div>
<div class=""><br class="">
</div>
<div class="">The latter styles are used in two
excellent books: <i class="">The Oberon System</i> by
Martin Reiser and <i class="">Object-Oriented
Programming in Oberon-2</i> by Hanspeter Mössenböck.
These books are the two best typeset Oberon books
there are (imho). Unfortunately both have long been
out of print. A scanned copy of <i class="">The Oberon
System</i> can be found on the internet here: <a
moz-do-not-send="true"
href="http://oberoncore.ru/library/reiser_the_oberon_system_user_guide_and_programmers_manual"
class="">http://oberoncore.ru/library/reiser_the_oberon_system_user_guide_and_programmers_manual</a> ,
and there's a pdf-version of <i class="">OOP in
Oberon-2</i> here: <a moz-do-not-send="true"
href="http://ssw.jku.at/Research/Books/Oberon2.pdf"
class="">http://ssw.jku.at/Research/Books/Oberon2.pdf</a> .
In this pdf the source code indentation is not
rendered entirely accurately, so also have look at a
scanned version of this book: <a
moz-do-not-send="true"
href="https://books.google.nl/books?id=BseoCAAAQBAJ&printsec=frontcover&dq=object+oriented+programming+in+oberon-2&hl=nl&sa=X&redir_esc=y#v=onepage&q=object%20oriented%20programming%20in%20oberon-2&f=false"
class="">https://books.google.nl/books?id=BseoCAAAQBAJ&printsec=frontcover&dq=object+oriented+programming+in+oberon-2&hl=nl&sa=X&redir_esc=y#v=onepage&q=object%20oriented%20programming%20in%20oberon-2&f=false</a></div>
<div class=""><br class="">
</div>
<div class="">--</div>
<div class="">Hans Klaver</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
</div>
<div><br class="">
</div>
</div>
</div>
</div>
<br class="">
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">--
<a class="moz-txt-link-abbreviated" href="mailto:Oberon@lists.inf.ethz.ch">Oberon@lists.inf.ethz.ch</a> mailing list for ETH Oberon and related systems
<a class="moz-txt-link-freetext" href="https://lists.inf.ethz.ch/mailman/listinfo/oberon">https://lists.inf.ethz.ch/mailman/listinfo/oberon</a>
</pre>
</blockquote>
<br>
<p><br>
</p>
<pre class="moz-signature" cols="72">--
____________________________________
Dr. Dieter Glötzel
Im Rosengarten 27
64367 Mühltal
Tel.: 06151 / 360 82 72</pre>
</body>
</html>