[m-dev.] pragma stub proposal

Ian MacLarty maclarty at csse.unimelb.edu.au
Wed Aug 12 13:19:09 AEST 2009


Hi,

I recently wrote a binding to JDBC in Mercury.  To avoid errors when
compiling the module in C grades (the module could still be linked in
even if it isn't used) I added stub versions of the Java foreign procs
like so:

jdbc_get_dbms_name(_, _, _, _, !IO) :- error("non-Java grade").

The problem with this is that I then get a determinism warning, since
it is inferred erroneous.

The other option is to use --allow-stubs and --no-warn-stubs, but that
will create stubs for *all* predicates without any clauses,
potentially hiding real errors.

What I would prefer is to be able to tell the compiler to create stubs
for a specific set of predicates with a pragma.  For example:

:- pragma stub(jdbc_get_dbms_name/6).

Any comments?  Is there a better way to do it?

Cheers,
Ian.
--------------------------------------------------------------------------
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