[m-dev.] pragma stub proposal

Peter Wang novalazy at gmail.com
Thu Aug 13 13:53:36 AEST 2009


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

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



More information about the developers mailing list