🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #3380

Re: structured types & procedures

#3380
From: Peter Moylan
Date: Sun, 17 Mar 1996 22:16
39 lines
2077 bytes
J.Last (eljl3@dwalin.lut.ac.uk) wrote:

>My FTL M-2 compiler allows me to return structured types like this:

>PROCEDURE Thingy(Bob:REAL):StructuredType;

>Whereas the StonyBrook DOS compiler won't let me. I have to do:

>PROCEDURE Thingy(Bob:REAL;VAR Fred:StructuredType);

>Is there a good reason for this?

The original Modula-2 compilers, as described in "Programming
in Modula-2" by Niklaus Wirth, did not allow structured
types as function return types.  This followed a tradition
established in Pascal.  Wirth is reported to have said that
this was an implementation restriction rather than a language
rule; nevertheless, the de-facto standard of the time, as
described in PIM3, seemed to suggest that structured types
were not allowed, so that was the rule followed by
compiler-writers who thought they were sticking to the
standard.

In some compilers, the authors decided that this was a
stupid restriction, and introduced functions with structured
return types as a "language extension".  In fact, most
M2 compilers I've seen allow this.

Now that we have a proper M2 standard, the situation has
been clarified: structured return types are in the language,
and compilers should support them.  The catch, of course, is
that the standard is so new that most compilers haven't
caught up with it.

--
Peter Moylan                           peter@ee.newcastle.edu.au
                  http://www.eng.newcastle.edu.au/ee/Moylan.html
OS/2 freeware list at 
      http://www.eng.newcastle.edu.au/ee/Moylan/os2/os2info.html
Technical Details
Message-ID: <4ii2v8$ju3@seagoon.newcastle.edu.au>
Path: arc1-ca.pugleaf.net!fourier.newcastle.edu.au!peter
References: <DnrCDH.17u@lut.ac.uk> <4hmu5o$vje@locutus.rchland.ibm.com> <DoBD6w.6HI@lut.ac.uk>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!fourier.newcastle.edu.au!peter
From: peter@fourier.newcastle.edu.au (Peter Moylan)
Newsgroups: comp.lang.modula2
Subject: Re: structured types & procedures
Date: 17 Mar 1996 22:16:08 GMT
Organization: The University of Newcastle
Message-ID: <4ii2v8$ju3@seagoon.newcastle.edu.au>
References: <DnrCDH.17u@lut.ac.uk> <4hmu5o$vje@locutus.rchland.ibm.com> <DoBD6w.6HI@lut.ac.uk>
Reply-To: peter@tesla.newcastle.edu.au
NNTP-Posting-Host: fourier.newcastle.edu.au
X-Newsreader: TIN [version 1.2 PL2]