<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto">Hi all<div><br></div><div>In low layer modules, I like to declare local TYPEs in a procedure to redefine the TYPE of a parameter. Just as an example parameter is INTEGER, I would like to work with C4 = ARRAY 4 OF CHAR. Obviously, I could work on the parameter with pure SYSTEM.GETs but for the sake of the example let’s stick to C4 for a minute.</div><div><br></div><div>Now, as Oberon has no macros, I declare in my PROCEDURE with the local C4 another nested procedure as kind of writing shortcut in my procedure’s code.</div><div>Et voila, I‘m in the situation where the nested procedure should have access to the intermediately declared C4.<br><br>Would you accept this as a valid example for intermediate TYPEs?</div><div><br><div>Jörg</div><div><br>Am 10.02.2018 um 13:16 schrieb Andreas Pirklbauer <<a href="mailto:andreas_pirklbauer@yahoo.com">andreas_pirklbauer@yahoo.com</a>>:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=utf-8"><span class="" style="font-family: monospace; white-space: pre-wrap;">  > That may be so but may also be irrelevant. I can't think of any genuine use</span><div class=""><span class="" style="font-family: monospace; white-space: pre-wrap;">  > for an intermediate TYPE if intermediate variables of that type are inaccessible. 
  >
  > Can you refer me to an existing real-world practical Oberon example where an</span></div><div class=""><span class="" style="font-family: monospace; white-space: pre-wrap;">  > intermediate type is accessed in a nested procedure?
  >
  > Chris<br class=""></span><div class=""><span class="" style="font-family: monospace; white-space: pre-wrap;"><br class=""></span></div><div class=""><span class="" style="font-family: monospace; white-space: pre-wrap;">I can’t think of any! </span><span class="" style="font-family: monospace; white-space: pre-wrap;">In a previous post I have provided an implementation that</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">PO2013 makes the compiler </span><span style="font-family: monospace; white-space: pre-wrap;" class="">consistent in the sense that ALL intermediate objects</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">(constants, </span><span style="font-family: monospace; white-space: pre-wrap;" class="">types, procedures) </span><span style="font-family: monospace; white-space: pre-wrap;" class="">are now treated identically with respect</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">to *access rights*, i.e. </span><span style="font-family: monospace; white-space: pre-wrap;" class="">they cannot be </span><span style="font-family: monospace; white-space: pre-wrap;" class="">accessed in a nested procedures.</span></div></div><div class=""><span class="" style="font-family: monospace; white-space: pre-wrap;"><br class=""></span></div><div class=""><span class="" style="font-family: monospace; white-space: pre-wrap;">A separate question is of course whether one should allow the ability to *declare*</span></div><div class=""><span class="" style="font-family: monospace; white-space: pre-wrap;">local </span><span class="" style="font-family: monospace; white-space: pre-wrap;">types or constants </span><span style="font-family: monospace; white-space: pre-wrap;" class="">at all - it makes of course sense to </span><span style="font-family: monospace; white-space: pre-wrap;" class="">keep that possibility.</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""><br class=""></span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">But if local procedures were *eliminated* from the language one day, </span><span style="font-family: monospace; white-space: pre-wrap;" class="">then the whole</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">access discussion goes </span><span style="font-family: monospace; white-space: pre-wrap;" class="">away completely, since in that case intermediate objects (of</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">any </span><span style="font-family: monospace; white-space: pre-wrap;" class="">kind!) simply can no longer exist. There can only be (a) global objects or (b)</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">objects that are </span><span style="font-family: monospace; white-space: pre-wrap;" class="">local to (globally declared) procedures.</span></div><div class=""><br class=""></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">As I said, one can endlessly debate all this…</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=""></span></font></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""><br class=""></span></div></div></blockquote><blockquote type="cite"><div><span>--</span><br><span><a href="mailto:Oberon@lists.inf.ethz.ch">Oberon@lists.inf.ethz.ch</a> mailing list for ETH Oberon and related systems</span><br><span><a href="https://lists.inf.ethz.ch/mailman/listinfo/oberon">https://lists.inf.ethz.ch/mailman/listinfo/oberon</a></span><br></div></blockquote></div></body></html>