Sven-Bodo Scholz <[EMAIL PROTECTED]> pisze:

> f:: Num a => a -> a
> 
> Is there any way to export "all potential versions of f" ????
>
> The next step would be to ask how to export polymorphism such as
> 
> id:: a -> a
> 
> Is there a convenient way for exporting these functions??

The Mercury compiler's C interface allows this.
When you import or export a polymorphic Mercury procedure to/from C,
the dictionary passing is exposed.  From the C side, dictionaries
are abstract data types, but C code can be passed dictionaries or
can call existentially typed Mercury procedures to obtain dictionaries,
and can then pass those dictionaries to polymorphic Mercury procedures.

On 31-Jul-2000, Marcin 'Qrczak' Kowalczyk <[EMAIL PROTECTED]> wrote:
> How would you use such function in C? C does not support polymorphism
> directly.

Sure it does... that's what `void *' is for ;-)

-- 
Fergus Henderson <[EMAIL PROTECTED]>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger [EMAIL PROTECTED]        |     -- the last words of T. S. Garp.

Reply via email to