[M3devel] Multiple executables from the same source

Jay K jay.krell at cornell.edu
Sun Jul 7 10:13:42 CEST 2013

 > I'd like to be able to test multiple implementations of a single interface,

I suggest you use objects here. And a common base type.
Like how "interface" is interpreted in Java, C#, and COM.
Modula-3 supports this well enough, just with different terminology.
 - Jay

From: jay.krell at cornell.edu
To: hendrik at topoi.pooq.com; m3devel at elegosoft.com
Date: Sun, 7 Jul 2013 05:46:03 +0000
Subject: Re: [M3devel] Multiple executables from the same source

I think you have multiple obvious choices, that you are aware of, that you don't think you want:
1) put it all in one src, one executable, a command line switch to choice the test case, AND have an option in the m3makefile and Main.m3 to omit the test code
1b) or just live it with it all being present all the time
2) break out the code into multiple libraries and multiple executables; including having more stuff in your public interface than you otherwise would..
"Hey, look", I've worked with a few build systems. Mostly NT Build.
There seems to be some Digital (DEC) line of descent visible in about half of the programming world, and Modula-3 and NT and NT Build live there. (The other half is Unix). m3quake and NT Build have an amazing coincidence in overall design and feel. They both are declarative with an escape. NT Build is actually a thin wrapper over nmake, such that many people don't realize nmake is there, but the escape is nmake/makefile.inc. 
m3quake/cm3 is its own language, the declarations are actually function calls, and the escape is the fairly general scripting language. Most people just use the declarative stuff and don't break out into the programming language.
(NT Build is publically available in the Windows DDK, at least until recent versions.)
They both limit, mostly, source files to be in leaf directories.
You can't reach around and build random source from random other places.
Unless you turn it into a library or .obj.
NT Build does have an obscure little used feature named UMTEST/UMAPPL. Where you can build multiple test apps in one leaf. They are afforded one source file each, and I think link to the rest of the directory, i.e. a library. In specifying these test cases though, the full generality of what you can do in a directory is lost.
In m3quake/cm3-speak -- consider "import". Which executable are you importing for? One special one? All of them? The same problems..
Given the successful scale of both of these systems (really, of NT build), I suggest the designers knew very well what they were doing and anything we complain is missing, they were probably actually doing us a favor by omitting, we should live with the limitations and be happy to have received such a decent scalable design. :)
>   with its own m3makefile and its own symbolic link to a common src directory.

And how are you going to check that into CVS and sync and build it on file systems without symlinks?
Not portable.
 - Jay

> Date: Sat, 6 Jul 2013 22:11:18 -0400
> From: hendrik at topoi.pooq.com
> To: m3devel at elegosoft.com
> Subject: [M3devel] Multiple executables from the same source
> I'm writiing and debugging a bunch of interfaces and modules.
> They are all supposed to fit together into one happy executable.
> But of course, until I've finished debugging them
>   they fit together into one unhappy executable.
> To test them properly I'd like to write a series of unit tests.
> To run these tests I will need  to make further executables,
>   each consisting of a test modules and several of the modules under test.
> Now with the usual structure of a Modula 3 workspace,
>   there is one m3makefile and a src directory, and it makes one executable,
>   not many,
>   and it doesn't really give me a choice of which executable I want.
> In the old days of C code and Makefiles, I could have multiple targets
>   each one being built with its own cc command
>   with its own list of source files names.
> Is there anything comparable for Modula 3?
> The best I've come up sith so far is to have a number of directories,
>   one for each test case,
>   with its own m3makefile and its own symbolic link to a common src directory.
> Is there something better?
> I'm not really interested in having all the test code
>   be part of the final application.
> For one thing,
>   I'd like to be able to test multiple implementations of a single interface,
>   such as a reference implementation and an efficient one,
>   so that I can compare the output and complain about the differences.
> -- hendrik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20130707/dfb814e1/attachment-0002.html>

More information about the M3devel mailing list