[mercury-users] foreign_type
Peter Ross
pro at missioncriticalit.com
Mon Jun 3 23:13:22 AEST 2002
michael wrote:
> petdr wrote:
> > Instead you could write
> >
> > :- type constrained_foo(T) ---> constrained_foo(foo).
>
> Yes, but then the compiler thoughtfully passes everything as an
MR_Word it
> seems and I have to put back all the type casts that using foreign
type
> allowed me to remove.
>
You could write the code as follows, inlining would avoid any of the
overhead of doing it this way.
p(constrained_foo(Foo)) :-
p_2(Foo).
:- pred p_2(foo) is semidet.
:- pragma foreign_proc(c, p_2(Foo::in), .....
--------------------------------------------------------------------------
mercury-users mailing list
post: mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the users
mailing list