[m-dev.] Re: conditional compilation
Peter Wang
novalazy at gmail.com
Thu Jan 7 12:27:34 AEDT 2010
On 2010-01-07, Julien Fischer <juliensf at csse.unimelb.edu.au> wrote:
>
> How about this: add a pragma that that marks certain procedures as being
> conditional on something, e.g.
>
> :- pragma conditional_proc(foo/2, [<conditions>]).
> :- pred foo(io::di, io::uo) is det.
It wouldn't allow alternative clauses based on the condition.
Here's a trick to reduce the number of stub foreign_procs you have to
write, for the situation I described: use a wrapper type around the real
du type, and only override the wrapper type with the foreign type.
:- type foo ---> foo(bar).
:- type bar ---> bar(int, int).
:- pragma foreign_type("Java", foo, "JavaFoo").
Then Mercury clauses which deconstruct bar variables can still be
typechecked in the Java grade. It would be nicer if you could override
an equivalence type with a foreign type, but you can't.
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