[m-dev.] pragma stub proposal

Ian MacLarty maclarty at csse.unimelb.edu.au
Wed Aug 12 16:00:45 AEST 2009

On Wed, Aug 12, 2009 at 3:22 PM, Julien
Fischer<juliensf at csse.unimelb.edu.au> wrote:
> 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?

You wouldn't provide the clause in the presence of this pragma.


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