<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""> > </span></font><span style="font-family: monospace; white-space: pre-wrap;" class="">One reason why nested procedures still exist may be that they</span><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""> </span></font><span style="font-family: monospace; white-space: pre-wrap;" class="">> </span><span style="white-space: pre-wrap; font-family: monospace;" class="">can (sometimes) be used for eliminating problems with forward references.</span></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""> </span></font><span style="font-family: monospace; white-space: pre-wrap;" class="">> </span><span style="white-space: pre-wrap; font-family: monospace;" class="">See NWs hint in </span><span style="white-space: pre-wrap; font-family: monospace;" class=""><a href="http://people.inf.ethz.ch/wirth/Oberon/PortingOberon.pdf" class="">http://people.inf.ethz.ch/wirth/Oberon/PortingOberon.pdf</a>.</span></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""><br class=""></span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">True. However, the case cited in this paper appears to be rather rare in</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">practice (please </span></font><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">correct me if I am wrong) as </span></font><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">it works only if one </span></font><span style="white-space: pre-wrap; font-family: monospace;" class="">of the</span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class="">procedures is </span><span style="font-family: monospace; white-space: pre-wrap;" class="">called *only* from within the </span><span style="font-family: monospace; white-space: pre-wrap;" class="">other (</span><span style="font-family: monospace; white-space: pre-wrap;" class="">P and Q in paper). </span><span style="white-space: pre-wrap; font-family: monospace;" class="">The</span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class="">general </span><span style="white-space: pre-wrap; font-family: monospace;" class="">case will typically involve the introduction </span><span style="white-space: pre-wrap; font-family: monospace;" class="">of procedure </span><span style="white-space: pre-wrap; font-family: monospace;" class="">variables</span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class="">anyway. </span><span style="font-family: monospace; white-space: pre-wrap;" class="">Indeed, the most recent version of the </span><span style="font-family: monospace; white-space: pre-wrap;" class="">Oberon-07 compiler </span><span style="white-space: pre-wrap; font-family: monospace;" class="">uses </span><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">global</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">procedure variables </span></font><span style="white-space: pre-wrap; font-family: monospace;" class="">for </span><span style="white-space: pre-wrap; font-family: monospace;" class="">“expression”, “Type” and “FormalType</span><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">”.</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""><br class=""></span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">After decades of reading compilers *with* forward references *and* the</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">familiar nested </span></font><span style="white-space: pre-wrap; font-family: monospace;" class="">expression-term-factor constructs, I was a bit irritated</span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class="">at first when I </span><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">saw this approach, but </span></font><span style="white-space: pre-wrap; font-family: monospace;" class="">if one sticks to sensible naming</span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class="">conventions (e.g. always add a 0), I </span><span style="font-family: monospace; white-space: pre-wrap;" class="">found it to be acceptable and not</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">impacting </span><span style="font-family: monospace; white-space: pre-wrap;" class="">readability. The performance overhead by using procedure </span><span style="font-family: monospace; white-space: pre-wrap;" class="">variables</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">(requiring one extra address lookup at run time) seems to be negligible</span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class="">in this particular case, as most of the time in the compiler is </span><span style="font-family: monospace; white-space: pre-wrap;" class="">not spent</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">in procedure activations, but elsewhere.</span></div><div class=""> </div><div class=""><br class=""></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""> </span></font><span style="font-family: monospace; white-space: pre-wrap;" class="">> </span><span style="white-space: pre-wrap; font-family: monospace;" class="">One other reason why locally declared constants, types, and procedures</span></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""> </span></font><span style="font-family: monospace; white-space: pre-wrap;" class="">> </span><span style="white-space: pre-wrap; font-family: monospace;" class="">still exist may be that</span></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""> </span></font><span style="font-family: monospace; white-space: pre-wrap;" class="">> </span><span style="white-space: pre-wrap; font-family: monospace;" class="">there should be some difference to C ;-)</span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class=""><br class=""></span></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">So much for a really good reason ;-)</span></font><span style="font-family: monospace; white-space: pre-wrap;" class=""> Personally, I believe eliminating</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">local </span><span style="font-family: monospace; white-space: pre-wrap;" class="">procedures </span><span style="white-space: pre-wrap; font-family: monospace;" class="">would not do much harm. It’s one of those things one</span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class="">might be emotionally </span><span style="white-space: pre-wrap; font-family: monospace;" class="">attached to a little bit if one was used them for</span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class="">avery long time - </span><span style="font-family: monospace; white-space: pre-wrap;" class="">since the Algol days (and even before..). When modules</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">came along in the 70s, the module took over some benefits previously</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">associated with local procedures in Pascal (which had only a single</span></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">source file, so it made more sense to “structure” the code this way).</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""><br class=""></span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">In the few cases where it is, perhaps, desirable to nest a procedure</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">to indicate </span></font><span style="white-space: pre-wrap; font-family: monospace;" class="">that it is called only from the enclosing procedure, one</span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class="">can certainly </span><span style="white-space: pre-wrap; font-family: monospace;" class="">live with those procedures being global</span><span style="font-family: monospace; white-space: pre-wrap;" class="">. After all, since</span></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">Modula-2 the module is now the unit of information hiding, not the</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">procedure. Since the programmer is in full control of the module, he</span></font></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class="">(hopefully) knows when to call a global (not exported) procedure.</span></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""><br class=""></span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">AP</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""><br class=""></span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""><br class="Apple-interchange-newline"><br class=""></span></font><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""><br class=""></span></div></div></body></html>