[m-dev.] pragma stub proposal

Julien Fischer juliensf at csse.unimelb.edu.au
Thu Aug 13 14:38:04 AEST 2009


On Thu, 13 Aug 2009, Peter Wang wrote:

> On 2009-08-13, Ian MacLarty <maclarty at csse.unimelb.edu.au> wrote:
>> % Now define det_error, so we can throw an exception in the stub
>> without getting a warning:
>> :- pred det_error(string::in, io::di, io::uo) is det.
>> det_error(Msg, !IO) :-
>>     ( semidet_succeed ->
>>         error(Msg)
>>     ;
>>         true
>>     ).
>>
>> % Now define the stub for non-Java grades:
>> jdbc_get_dbms_name(_, "", -1, "", !IO) :- det_error("non-Java grade", !IO).
>>
>> I guess this isn't too bad really.
>
> The problem is that you must provide fake output arguments, sometimes
> which is not that easy (foreign types).

Most of the time when this occurs it's because you have a Mercury
definition of something that is also defined in one of the foreign
languages.  For those Mercury definitions the types involved are almost
always unit dummy types.

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