<div dir="ltr">While we're on the subject, there's a compiler bug in there somewhere:<div><br></div><div><div>CONST A = ARRAY OF ARRAY OF INTEGER{ARRAY OF INTEGER{1}};</div></div><div><br></div><div>compiles but</div><div><br></div><div><div><div>CONST A = ARRAY OF ARRAY OF INTEGER{ARRAY OF INTEGER{}};</div></div></div><div><br></div><div>results in</div><div><br></div><div><div>***</div><div>*** runtime error:</div><div>*** <*ASSERT*> failed.</div><div>*** file "../src/exprs/ArrayExpr.m3", line 653</div><div>***</div></div><div><br></div><div>This may be the same or a related bug:</div><div><br></div><div><div>TYPE R = RECORD a := 1 END;</div><div>CONST B = ARRAY OF R{R{}};</div><div>CONST C = B[0].a; (* error: value is not constant *)</div></div><div><br></div><div>but</div><div><br></div><div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial"><div>TYPE R = RECORD a := 1 END;</div><div>CONST B = ARRAY OF R{R{1}};</div><div>CONST C = B[0].a; (* no error *)</div></div><br></div><div><br></div><div><br></div><div>Back on topic, although I can understand you not liking the construct, given that it's unlikely to make someone to write incorrect code (dereferencing is the only possible operation and is required), is it worth breaking existing code? Not knowing of its use anywhere isn't definitive.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Mar 24, 2018 at 4:53 PM, Rodney M. Bates <span dir="ltr"><<a href="mailto:rodney_bates@lcwb.coop" target="_blank">rodney_bates@lcwb.coop</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
<br>
<br>
On 03/21/2018 02:57 PM, Henning Thielemann wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
On Wed, 21 Mar 2018, Rodney M. Bates wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Modula3, 2.6.3 (Designators), concerning subscripting says:<br>
<br>
An expression of the form a[i_1, ..., i_n] is shorthand for a[i_1]...[i_n].<br>
</blockquote>
<br>
I think I wrote earlier about this shorthand ...<br>
<br>
I found the following problem:<br>
<br>
ARRAY OF ARRAY OF Something<br>
<br>
is syntactically not quite a 2D-array since as it is written it suggests that the sub-arrays may have different sizes.<br>
</blockquote>
<br></span>
It never occurred to me that this syntax could suggest it could be a ragged array, probably because<br>
I was already familiar with the (fixed) array-of-array concept being truly 2D in Pascal and Modula2.<br>
<br>
I do see in 2.2.3, in the first paragraph: "The elements all have the same size and the same type,<br>
called the _element type_ of the array", this sentence applying to both fixed and open arrays.<br>
This probably should be clarified, since "size" seems not very precise here. Maybe "element count",<br>
which would be harmlessly redundant in the case of a fixed array.<br>
<br>
Two paragraphs later, the definition of array _shape_ seems also to imply the array is not ragged,<br>
but this is perhaps too subtle not to be made explicit somewhere.<span class=""><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
This has practical consequences. It would be no problem to have a 0-by-n array. But Modula-3 fails<br>
to determine the size of the second dimension of a 0-by-n array, because LAST(a[0]) is a range<br>
violation in the first dimension.<br>
</blockquote>
<br></span>
But a[0] doesn't exist, so what would be a meaningful definition of its size or bounds? Even if you<br>
could somehow define and discover it, you can't do anything else with a[0] either.<br>
<br>
The only way I can think of create such a thing would be a zero-length SUBARRAY of an mxn array.<br>
Neither the language nor the compiler disallow a a zero-length SUBARRAY. a could alias the<br>
original mxn array, but only an empty portion of it. Other than copying and passing a around<br>
by reference, there is no meaningful definition of any operation on a.<span class="im HOEnZb"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
______________________________<wbr>_________________<br>
M3devel mailing list<br>
<a href="mailto:M3devel@elegosoft.com" target="_blank">M3devel@elegosoft.com</a><br>
<a href="https://m3lists.elegosoft.com/mailman/listinfo/m3devel" rel="noreferrer" target="_blank">https://m3lists.elegosoft.com/<wbr>mailman/listinfo/m3devel</a><br>
<br>
</blockquote>
<br></span><span class="HOEnZb"><font color="#888888">
-- <br>
Rodney Bates<br>
<a href="mailto:rodney.m.bates@acm.org" target="_blank">rodney.m.bates@acm.org</a></font></span><div class="HOEnZb"><div class="h5"><br>
______________________________<wbr>_________________<br>
M3devel mailing list<br>
<a href="mailto:M3devel@elegosoft.com" target="_blank">M3devel@elegosoft.com</a><br>
<a href="https://m3lists.elegosoft.com/mailman/listinfo/m3devel" rel="noreferrer" target="_blank">https://m3lists.elegosoft.com/<wbr>mailman/listinfo/m3devel</a><br>
</div></div></blockquote></div><br></div>