[m-dev.] pragma stub proposal

Julien Fischer juliensf at csse.unimelb.edu.au
Wed Aug 12 15:22:27 AEST 2009

On Wed, 12 Aug 2009, Ian MacLarty wrote:

> 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).

So you wouldn't provide the above clause in the presence of this pragma?
Or do you use the pragma as well as the clause and the effect of the
pragma is just to disable the warning for that predicate?

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