<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=""><span style="font-family: monospace; white-space: pre-wrap;" class="">> On </span><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">Thu Oct 12 14:17:17 CEST 2017 Chris Burrows wrote:</span></font><div class=""><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="">> In May 2016, the Oberon array assignment rule was relaxed</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">> with the addition of the following rule:
>
> "9.1.4. An open array may be assigned to an array of equal base type.”
>
> Since that time you have been able to write:
>
> PROCEDURE P(s: ARRAY OF CHAR);
> VAR local: ARRAY 255 OF CHAR;
> BEGIN local := s;
> END P;</span></font></div><div class=""><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="">> The downside of this is that the declaration of the local array has</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">> to be large enough to handle the largest array that might be passed to the procedure. This could lead to inefficient stack usage.
><br class="Apple-interchange-newline"></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="">Do you know the reason why the inverse operation, i.e. assignments *to* open arrays, is not supported? I.e. the operation</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=""> PROCEDURE Q(s: ARRAY OF CHAR);
VAR local: ARRAY 255 OF CHAR;
BEGIN s := local
END Q;</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="">or even</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=""> PROCEDURE R(s, t: ARRAY OF CHAR);
BEGIN s := t
END R;</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="">In all three cases (P, Q and R) the assignments would be rather easy to implement in the compiler,</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">as t</span><span style="font-family: monospace; white-space: pre-wrap;" class="">he </span><span style="font-family: monospace; white-space: pre-wrap;" class="">length of the open array </span><span style="font-family: monospace; white-space: pre-wrap;" class="">is always passed on the stack anyway (code pattern 10 in section</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">12.2. in the book Project Oberon) and therefore easily accessible. And i</span><span style="font-family: monospace; white-space: pre-wrap;" class="">n all three </span><span style="font-family: monospace; white-space: pre-wrap;" class="">cases the</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">check whether the length of the </span><span style="font-family: monospace; white-space: pre-wrap;" class="">source is <= the length of the destination cannot be done </span><span style="font-family: monospace; white-space: pre-wrap;" class="">at</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">compile anyway, but needs to be </span><span style="font-family: monospace; white-space: pre-wrap;" class="">done at runtime.</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="">-AP</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=""><br class=""></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=""><br class=""></span></div></body></html>