🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #1722

Re: Initialisation code: When is it called?

#1722
From: Randy Bush
Date: Thu, 31 Jan 1991 04:33
44 lines
1395 bytes
RW_GRIFFITHS@VAX.ACS.OPEN.AC.UK writes:

> Finally there is another rare case hen compilers can produce different
> initialization orders for the same program. This occurs when a module is
> imported into a definition module and then not used in the corresponding
> implementationmodule. In such cases some compilers do not initialize the
> imported module.

Given the following example, should we consider such programs Modula-2
compilers?

DEFINITION MODULE A;
EXPORT QUALIFIED p;
PROCEDURE p () : CARDINAL;
END A.

IMPLEMENTATION MODULE A;
VAR v : CARDINAL;
PROCEDURE p () : CARDINAL;
BEGIN
   RETURN (v)
   END p;
BEGIN
   v := 42
   END A.

DEFINITION MODULE B;
IMPORT A;
EXPORT p;
CONST p = A.p;
END B.

IMPLEMENTATION MODULE B;
END B.

MODULE Test;
IMPORT B;
BEGIN
   REPEAT
      UNTIL B.p() = 42
   END Test.

-- 
..!{uunet,qiclab,intelhf,bucket}!m2xenix!news
Technical Details
Message-ID: <1991Jan31.043344.12989@m2xenix.psg.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!rpi!dali.cs.montana.edu!milton!ogicse!pdxgate!parsely!percy!qiclab!m2xenix!news
References: <INFO-M2%91012907064459@UCF1VM.BITNET>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!rpi!dali.cs.montana.edu!milton!ogicse!pdxgate!parsely!percy!qiclab!m2xenix!news
From: news@m2xenix.psg.com (Randy Bush)
Newsgroups: comp.lang.modula2
Subject: Re: Initialisation code: When is it called?
Message-ID: <1991Jan31.043344.12989@m2xenix.psg.com>
Date: 31 Jan 91 04:33:44 GMT
References: <INFO-M2%91012907064459@UCF1VM.BITNET>
Organization: Pacific Systems Group, Portland Oregon US
Lines: 44