🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.lang.modula2
4 messages
4 total messages Started by Hal Chambers Wed, 19 Aug 1987 14:54
Redundant import
#3753
Author: Hal Chambers
Date: Wed, 19 Aug 1987 14:54
16 lines
1073 bytes
In some recent news articles I noticed the following type of constructs:

	DEFINITION MODULE abc;
	FROM IO IMPORT Open, Close, File, Read, Write;
	...

	IMPLEMENTATION MODULE abc;
	FROM IO IMPORT Open, Close, File, Read, Write;
	...

It is not necessary to repeat the imports in the implementation module
since the all declarations of the definition module are automatically
known to the implementation module.  The implementation module only
needs to import names which are to be hidden from the definition module.

Hal Chambers
Re: Redundant import
#3763
Author: Samuel B. Bassett
Date: Fri, 21 Aug 1987 05:16
18 lines
1512 bytes
In article <802@newton.physics.purdue.edu> hal@newton.physics.purdue.edu (Hal Chambers) writes:

>It is not necessary to repeat the imports in the implementation module
>since the all declarations of the definition module are automatically
>known to the implementation module.  The implementation module only
>needs to import names which are to be hidden from the definition module.

	As a followup, is it then considered a bug about which one is 
justified in screaming at the compiler writer, when objects imported in the 
DEFINITION Module are _NOT_ visible when compiling the IMPLEMENTATION Module?
	e.g. Logitech's Modula-2/86 for MS/PC-DOS.

	Or is this a matter left to the judgement/ingenuity of the implementor?
-- 
Sam'l Bassett, Semantic Engineer -- My words & ideas are for sale!
34 Oakland Ave., San Anselmo  CA  94960;  (415) 454-7282
UUCP:  {...known world...}!hplabs OR ptsfa OR lll-crg!well!samlb;
Compuserve:  71735,1776;  WU Easylink ESL 6284-3034;  MCI SBassett
Re: Redundant import
#3765
Author: Alan Lovejoy
Date: Fri, 21 Aug 1987 14:26
11 lines
1101 bytes
In article <802@newton.physics.purdue.edu> hal@newton.physics.purdue.edu.UUCP writes:
>It is not necessary to repeat the imports in the implementation module
>since the all declarations of the definition module are automatically
>known to the implementation module.  The implementation module only

That depends on your compiler.  Some actually require the imports to
occur in both the definition and implementation modules.

I tend to agree with you that this is rather silly, however.

Alan "Don't you have to have a license to IMPORT?" Lovejoy
Re: Redundant import
#3781
Author: fred sullivan
Date: Wed, 26 Aug 1987 20:55
37 lines
2621 bytes
In article <3785@well.UUCP> samlb@well.UUCP (Samuel B. Bassett) writes:
>In article <802@newton.physics.purdue.edu> hal@newton.physics.purdue.edu (Hal Chambers) writes:
>
>>It is not necessary to repeat the imports in the implementation module
>>since the all declarations of the definition module are automatically
>>known to the implementation module.  The implementation module only
>>needs to import names which are to be hidden from the definition module.
>
>	As a followup, is it then considered a bug about which one is 
>justified in screaming at the compiler writer, when objects imported in the 
>DEFINITION Module are _NOT_ visible when compiling the IMPLEMENTATION Module?

There has been discussion of this in the past, to which I did not
contribute.  Thus I'll have my say now.  I am going to quote from Wirth,
second edition.  (Sorry, I don't have third edition so I don't know what it
says.)
Page 164:  "Both [implementation modules and definition modules] may contain
import lists, and all objects declared in the definition module are
available in the corresponding implementation module without explicit
import."
Thus the only possible question is:  Does an import constitute a
declaration?  I can't find a direct answer to this question, but I can find
an indirect answer.
Page 159:  "Standard identifiers are always imported automatically.  As a
consequence, standard identifiers can be redeclared in procedures only, but
not in modules ..."
And how were they declared to begin with?  By the automatic IMPORT.

I claim it's a bug, and one is completely justified in screaming at the
compiler writer.  Rumor has it that the Waterloo compiler also behaves this
way.  Does anyone know the truth?

Fred Sullivan
Department of Mathematical Sciences
State University of New York at Binghamton
Binghamton, New York  13903
Email: sullivan@marge.math.binghamton.edu
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads