FFI progress

Manuel M. T. Chakravarty chak at cse.unsw.edu.au
Mon Apr 16 22:46:51 EDT 2001

"Simon Peyton-Jones" <simonpj at microsoft.com> wrote,

> Manuel
> | The FFI discussion seems to be completely stalled.  Would 
> | you, as our Tsar, like to summarise the state of play, and 
> | re-invigorate it? 
> There was a bit of discussion, which led, I think to a simplification
> of the library stuff.  But we don't have a summary (even informal)
> of the current state of play, and that's beginning to be a problem here
> because we're about to implement the .NET FFI for GHC.

I am at this now.  Starting with the foreign import/export
declarations to summarise what we discussed.

> There's one particular issue we havn't discussed.  For Java and .NET
> we want to call static methods, dynamic methods, and constructors.
> We already have
> 	foreign import static
> 	foreign import dynamic
> but 'new' is different again.  The obvious place for it is in the
> language-specific
> string
> 	foreign import static "new foo(int x)" foo :: Int -> IO Foo
> It seems a bit odd to have static/dynamic *outside* but "new" inside the
> language-specific string.  I suppose the justification is that 'new' is
> really
> a static method with a funny way to call it.   Whereas the 'self'
> parameter
> on a dynamic call is treated specially.

Basically, as you say, from the point of Haskell, `new'
really is not that special, but there is a huge difference
between `static' and `dynamic'.  I think, this justifies
pushing `new' into the language specific string.


More information about the FFI mailing list