🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #1561

Re: multiple implementations

#1561
From: Peter Moylan
Date: Wed, 14 Oct 1992 01:56
57 lines
3451 bytes
In article <1992Oct12.200703.11026@rchland.ibm.com>, seurer@rchland.vnet.ibm.com (Bill Seurer) writes:
> In article <718850232snx@black.demon.co.uk>, tchannon@black.demon.co.uk (Tim Channon) writes:
> |> > Does anyone know of any good techniques for managing multiple implementation
> |> > modules?  A trivial example is for a Stack to have an array implementation
> |> > and a linked list implementation.   How do you name your files and how do
> |> 
> |> Pragmas?
> |> 
> |>   TC. 
> |>     E-mail: tchannon@black.demon.co.uk or tchannon@cix.compulink.co.uk
> |>                                 
> 
> Nah, you can do it with straight Modula-2 and a bit of indirection.  I
> wrote an IBM technical report on this but I don't know if they are
> available externally.
> 
> [Details omitted]

The answer to the original question, though, depends very much on the
environment supplied with the compiler.  The obvious solution is
to have three files:
    STACK.DEF
              starts with "DEFINITION MODULE Stack;"
    STACK1.MOD
              starts with "IMPLEMENTATION MODULE Stack;"
    STACK2.MOD
              starts with "IMPLEMENTATION MODULE Stack;"

In principle, whichever of STACK1.MOD and STACK2.MOD was last compiled
will be the one used in your executable.  It's then just a question
of organising your directories, etc. in a convenient way, and perhaps
setting up batch files of commands to select one or the other model.
(This is not a complete solution, but it's a start.)  I've used this
approach successfully in the past.

Now that I've started using TopSpeed M2, the whole structure collapses,
for two reasons:
 (a) the TopSpeed system often recompiles files even when you don't
     want it to, which can be a damned nuisance at times (especially
     when you've accidentally changed a low-level definition module
     by a mistake in using the "press any key to continue", and then
     deleted the erroneous character).  If there are multiple
     implementation modules in the search path it will find them all,
     and report this as an error even when it's not.
 (b) the TopSpeed system won't even accept the file names I used above,
     since it requires a match between the source file name and the module
     name (rather than the more logical approach of requiring a match
     between the module name and the symbol file name).

These problems occur because the TS project system tries to use the
same "make" strategy for Modula-2 and for C/C++ (which were never
intended for use in modular programming, and which therefore present
special problems in version checking).  They should not occur in a
system which was designed specifically for Modula-2.

-- 
Peter Moylan                      eepjm@wombat.newcastle.edu.au
Technical Details
Message-ID: <1992Oct14.115616.1@wombat.newcastle.edu.au>
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!munnari.oz.au!mel.dit.csiro.au!mineng.dmpe.CSIRO.AU!dmssyd.syd.dms.CSIRO.AU!metro!seagoon.newcastle.edu.au!wombat.newcastle.edu.au!eepjm
References: <01GPRDWLKI6Q0004IE@RCKHRST1.BITNET> <718850232snx@black.demon.co.uk> <1992Oct12.200703.11026@rchland.ibm.com>

Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.modula2
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!munnari.oz.au!mel.dit.csiro.au!mineng.dmpe.CSIRO.AU!dmssyd.syd.dms.CSIRO.AU!metro!seagoon.newcastle.edu.au!wombat.newcastle.edu.au!eepjm
From: eepjm@wombat.newcastle.edu.au (Peter Moylan)
Subject: Re: multiple implementations
Message-ID: <1992Oct14.115616.1@wombat.newcastle.edu.au>
Lines: 57
Sender: news@seagoon.newcastle.edu.au
Organization: University of Newcastle, AUSTRALIA
References: <01GPRDWLKI6Q0004IE@RCKHRST1.BITNET> <718850232snx@black.demon.co.uk> <1992Oct12.200703.11026@rchland.ibm.com>
Date: Wed, 14 Oct 1992 01:56:16 GMT