🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #3313

An ISO Standard Question

#3313
From: gstark
Date: Tue, 27 Feb 1996 13:56
34 lines
1173 bytes
Dear All,

I wonder if someone out there could clarify something
in the ISO standard. 

Using one of the two "ISO Compliant" compilers we've tested (XDS), this is legal:

TYPE 
  Str = ARRAY[1 .. 10] OF CHAR;
  StrArr = ARRAY[1 .. 2] OF Str;
VAR 
  s : StrArr;
BEGIN
  s := StrArr{"Hello" , "Mum" };

... but this is *illegal*:

TYPE 
  Str = ARRAY[1 .. 10] OF CHAR;
  StrArr = ARRAY[1 .. 2] OF Str;
CONST 
  s = StrArr{"Hello" , "Mum"};

However this structured constant *is* allowed under GPM2, the other
"ISO-conformant" M2 compiler that we've been using. Which is right?
In our existing code (using TopSpeed) we declare a lot of arrays of
strings as constants. So we'd like GPM to be right!

And if it is the case that variable constructors are legal but constant
constructors illegal, what was the thinking behind it?

regards,

Graham Stark
Technical Details
Message-ID: <1996Feb27.135653.53493@ucl.ac.uk>
Path: arc1-ca.pugleaf.net!bcc.ac.uk!library2.ifs.org.uk

Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.modula2
Path: arc1-ca.pugleaf.net!bcc.ac.uk!library2.ifs.org.uk
From: gstark@ifs.org.uk
Subject: An ISO Standard Question
Message-ID: <1996Feb27.135653.53493@ucl.ac.uk>
Date: Tue, 27 Feb 1996 13:56:19 GMT
Organization: University College London
X-Newsreader: IBM WebExplorer DLL