🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #2080

definition module loops

#2080
From: Devon E Bowen
Date: Thu, 09 May 1991 19:28
30 lines
1203 bytes
What are the rules regarding circular imports? For example, the following
code must be invalid because 'a' is never declared.

DEFINITION MODULE file1;
FROM file2 IMPORT a;
END file1.

DEFINITION MODULE file2;
FROM file1 IMPORT a;
END file2.

Yet it seems like the following should be valid because there is no such
conflict.

DEFINITION MODULE file1;
FROM file2 IMPORT b;
VAR a : INTEGER;
END file1.

DEFINITION MODULE file2;
FROM file1 IMPORT a;
VAR b : INTEGER;
END file2.

I haven't been able to find anywhere in Wirth's 4th edition that addresses
this issue. So what are the formal rules in this situation and what techniques
do most Modula-2 compilers use to implement them?

Devon
Technical Details
Message-ID: <75730@eerie.acsu.Buffalo.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!unix.cis.pitt.edu!dsinc!ub!bowen

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!unix.cis.pitt.edu!dsinc!ub!bowen
From: bowen@cs.Buffalo.EDU (Devon E Bowen)
Newsgroups: comp.lang.modula2
Subject: definition module loops
Message-ID: <75730@eerie.acsu.Buffalo.EDU>
Date: 9 May 91 19:28:37 GMT
Sender: news@acsu.Buffalo.EDU
Organization: State University of New York at Buffalo/Comp Sci
Lines: 30
Nntp-Posting-Host: castor.cs.buffalo.edu
Originator: bowen@castor.cs.buffalo.edu