[M3devel] Fwd: Re: A bizarre language quirk
Darko Volaric
lists at darko.org
Sat Mar 24 19:29:40 CET 2018
I've got more on the partial revelation side of things. Maybe we should use
the "issues" section of the GIthub repository to manage these and allow
others to work on them, should they be inclined.
On Sat, Mar 24, 2018 at 7:18 PM, Rodney M. Bates <rodney_bates at lcwb.coop>
wrote:
>
>
> On 03/24/2018 11:41 AM, Darko Volaric wrote:
>
>> While we're on the subject, there's a compiler bug in there somewhere:
>>
>> CONST A = ARRAY OF ARRAY OF INTEGER{ARRAY OF INTEGER{1}};
>>
>> compiles but
>>
>> CONST A = ARRAY OF ARRAY OF INTEGER{ARRAY OF INTEGER{}};
>>
>> results in
>>
>> ***
>> *** runtime error:
>> *** <*ASSERT*> failed.
>> *** file "../src/exprs/ArrayExpr.m3", line 653
>> ***
>>
>> This may be the same or a related bug:
>>
>> TYPE R = RECORD a := 1 END;
>> CONST B = ARRAY OF R{R{}};
>> CONST C = B[0].a; (* error: value is not constant *)
>>
>> but
>>
>> TYPE R = RECORD a := 1 END;
>> CONST B = ARRAY OF R{R{1}};
>> CONST C = B[0].a; (* no error *)
>>
>>
>>
> I'll add these to my list. I've been working on this area for some time,
> trying to get
> rid of CG crashes, etc.
>
>
>> 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.
>>
>>
> Sigh. OK. But i's sure C++-ish in harassing a maintainer by making
> something look significantly
> different from what it really is.
>
>
>> On Sat, Mar 24, 2018 at 4:53 PM, Rodney M. Bates <rodney_bates at lcwb.coop
>> <mailto:rodney_bates at lcwb.coop>> wrote:
>>
>>
>>
>>
>> On 03/21/2018 02:57 PM, Henning Thielemann wrote:
>>
>>
>> On Wed, 21 Mar 2018, Rodney M. Bates wrote:
>>
>> Modula3, 2.6.3 (Designators), concerning subscripting says:
>>
>> An expression of the form a[i_1, ..., i_n] is shorthand for
>> a[i_1]...[i_n].
>>
>>
>> I think I wrote earlier about this shorthand ...
>>
>> I found the following problem:
>>
>> ARRAY OF ARRAY OF Something
>>
>> is syntactically not quite a 2D-array since as it is written it
>> suggests that the sub-arrays may have different sizes.
>>
>>
>> It never occurred to me that this syntax could suggest it could be a
>> ragged array, probably because
>> I was already familiar with the (fixed) array-of-array concept being
>> truly 2D in Pascal and Modula2.
>>
>> I do see in 2.2.3, in the first paragraph: "The elements all have the
>> same size and the same type,
>> called the _element type_ of the array", this sentence applying to
>> both fixed and open arrays.
>> This probably should be clarified, since "size" seems not very
>> precise here. Maybe "element count",
>> which would be harmlessly redundant in the case of a fixed array.
>>
>> Two paragraphs later, the definition of array _shape_ seems also to
>> imply the array is not ragged,
>> but this is perhaps too subtle not to be made explicit somewhere.
>>
>> This has practical consequences. It would be no problem to have a
>> 0-by-n array. But Modula-3 fails
>> to determine the size of the second dimension of a 0-by-n array,
>> because LAST(a[0]) is a range
>> violation in the first dimension.
>>
>>
>> But a[0] doesn't exist, so what would be a meaningful definition of
>> its size or bounds? Even if you
>> could somehow define and discover it, you can't do anything else with
>> a[0] either.
>>
>> The only way I can think of create such a thing would be a
>> zero-length SUBARRAY of an mxn array.
>> Neither the language nor the compiler disallow a a zero-length
>> SUBARRAY. a could alias the
>> original mxn array, but only an empty portion of it. Other than
>> copying and passing a around
>> by reference, there is no meaningful definition of any operation on a.
>>
>> _______________________________________________
>> M3devel mailing list
>> M3devel at elegosoft.com <mailto:M3devel at elegosoft.com>
>> https://m3lists.elegosoft.com/mailman/listinfo/m3devel <
>> https://m3lists.elegosoft.com/mailman/listinfo/m3devel>
>>
>>
>> --
>> Rodney Bates
>> rodney.m.bates at acm.org <mailto:rodney.m.bates at acm.org>
>>
>> _______________________________________________
>> M3devel mailing list
>> M3devel at elegosoft.com <mailto:M3devel at elegosoft.com>
>> https://m3lists.elegosoft.com/mailman/listinfo/m3devel <
>> https://m3lists.elegosoft.com/mailman/listinfo/m3devel>
>>
>>
>>
> --
> Rodney Bates
> rodney.m.bates at acm.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20180324/3e2057e4/attachment.html>
More information about the M3devel
mailing list