[comp.lang.modula2] RETURN/HALT

Pat.Terry@p101.f19.n490.z2.fidonet.org (Pat Terry) (08/06/89)

(* RETURN and HALT at level 0

Recently doubt has been expressed as to the meaning of RETURN in program
modules, and level 0 modules.

I suggest that RETURN = HALT normally in main modules and
               RETURN = RETURN        in level 0 modules

At least one compiler has other ideas.

I would be curious to have the results for compilers to which I do not have
access.  A simple test program follows

*)

MODULE Return;
FROM InOut IMPORT WriteString;

   MODULE Inner;
     IMPORT WriteString;
     BEGIN
       WriteString('inner1');
       RETURN;
       WriteString('inner2')
     END Inner;

BEGIN
  WriteString('main1');
  RETURN;
  WriteString('main2')
END Return.


(*
Compiler                    Output
------------------------------------
Ana 68 (Sun)             |
Collier V2               |  inner1main1
FST                      |  inner1main1 - but RETURN is not "abnormal"
                                          whereas HALT would be
FTL                      |  rejects RETURN in both places
Hamburg VAX              |
HP9000/800               |
Logitech (MS-DOS 3.03)   |  inner1main1
Logitech (VAX)           |
MacMeth                  |
MacModula-2              |
Modula/370               |
Oregon (80386/Xenix)     |
Oregon (Sun)             |
Pecan Modula-2           |
Rowley                   |
Stonybrook               |
Stonybrook  (Quickmod)   |  inner1   (treats inner RETURN as HALT)
Taylor                   |
TDI (Atari ST)           |
TopSpeed                 |  inner1main1
Volition Sage/Stride     |  inner1main1

*)


--  
uucp: {mcvax!uunet,tektronix,sun!nosun}!oresoft!dawggon!2!490!19.101!Pat.Terry
Internet: Pat.Terry@p101.f19.n490.z2.fidonet.org

MSRS002@ECNCDC.BITNET ("THE DOCTOR.") (08/09/89)

I tried the example module "Return" in TopSpeed and got inner1main1.

Tom Ruby
MSRS002@ECNCDC