🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #3740

Re: exporting imports

#3740
From: David Hiebeler
Date: Mon, 17 Aug 1987 17:09
41 lines
2322 bytes
References:

Keywords:


About exporting types, vars, and procs that were imported:  I was told that
this does not work on some (even most?) compilers.
  I am using a DEC Compiler (Which, remember, is NOT a supported product
of DEC), on the VAX 11/780.  Here is exactly the form I use:
in the DEFINITION MODULE
  FROM io IMPORT (* type *) File,
		 (*  var *) Input,Output,
		 (* proc *) Open, Close;
  EXPORT QUALIFIED (* from io *)  File, Input, Output, Open, Close,
		   (* my own *) Write, WriteReal, WriteLn, .... ;

  I do not re-declare what the things are, or do things like:
    PROCEDURE Open(Fname:ARRAY OF CHAR; Mode:CHAR):File;
  I do declare my own procedures:
    PROCEDURE Write(Fname:File; Str:ARRAY OF CHAR);

Within the IMPLEMENTATION MODULE, I have this statement:
  FROM io IMPORT Open, Close, File, Readf, Writef;
Note that Input and Output need not be imported, as they will be passed
as parameters to the I/O procedures if they are needed.  Readf and Writef
are the procedures from io, which my own procedures call.

  I guess it's just a matter of luck whether you can do these things with
your compiler.  I am certainly glad that the one I use can; these things
are very natural to do, and certainly make things easier!  I suppose
an alternative would be simply to import the sub-module items (Input,Output,
File,Open,Close) in any program modules which needs them:
  FROM io IMPORT Open, Close, Input, Output, File;
  FROM InOut IMPORT Write, WriteLn, ReadReal, ...;
and in the DEFINITION MODULE of InOut, simply don't export the things from io.

                             -D.H.
----
David Hiebeler       hiebeler@csv.rpi.edu
Chatham, NY         "Illusions, Richard!  Every
(also Troy, NY)      bit of it illusions!"
Technical Details
Message-ID: <21@rpicsb8>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!rutgers!nysernic!rpicsb8!csv.rpi.edu!hiebeler

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!rutgers!nysernic!rpicsb8!csv.rpi.edu!hiebeler
From: hiebeler@csv.rpi.edu (David Hiebeler)
Newsgroups: comp.lang.modula2
Subject: Re: exporting imports
Message-ID: <21@rpicsb8>
Date: Mon, 17-Aug-87 13:09:39 EDT
Article-I.D.: rpicsb8.21
Posted: Mon Aug 17 13:09:39 1987
Date-Received: Tue, 18-Aug-87 04:51:14 EDT
Sender: nobody@rpicsb8
Reply-To: hiebeler@csv.rpi.edu (David Hiebeler)
Organization: RPI CS Dept, Troy, New York
Lines: 36