[m-dev.] conditional compilation

Ralph Becket rafe at csse.unimelb.edu.au
Wed Mar 25 15:39:05 AEDT 2009


Peter Wang, Wednesday, 25 March 2009:
> Hi,
> 
> Here is another idea: conditional sections, where a section is kept or
> omitted depending on compile time flags and/or grades.  If we borrow the
> feature from trace goals, we might have something like this:
> 
>     :- implementation(not(flag("production"))).
> 
> I can think of a couple of uses.
> 
> 1. I had an idea to ease writing test cases at MC.  One thing it would allow
> is embedding test code in the same file as the module it is testing, which
> may have certain advantages (or not, that's not the point here).  We could
> strip out test code for production builds.

That sounds appealing.

> 2. Modules which paper over platform differences or work with optional
> dependencies would be easier to write, or become possible without an
> explicitly preprocessing pass.  Any number of situations, really.
> 
> Peter
> --------------------------------------------------------------------------
> mercury-developers mailing list
> Post messages to:       mercury-developers at csse.unimelb.edu.au
> Administrative Queries: owner-mercury-developers at csse.unimelb.edu.au
> Subscriptions:          mercury-developers-request at csse.unimelb.edu.au
> --------------------------------------------------------------------------
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at csse.unimelb.edu.au
Administrative Queries: owner-mercury-developers at csse.unimelb.edu.au
Subscriptions:          mercury-developers-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the developers mailing list