[MLton] Callback to function pointer?

Wesley W. Terpstra wesley@terpstra.ca
Fri, 15 Jul 2005 00:38:08 +0200


On Thu, Jul 14, 2005 at 01:28:30PM -0700, Stephen Weeks wrote:
> >  _address "symbol";		==> MLton.Pointer.t
> >  _store *: 'a;		==> (MLton.Pointer.t * 'a) -> unit
> >  _store "symbol": 'a;		==> 'a -> unit
> >  _import *: 'a;		==> MLton.Pointer.t -> 'a
> >  _import "symbol": 'a;	==> 'a
> >  _export "symbol": 'a;	==> 'a -> unit
> 
> I like this.  I agree with others that it would be useful to have
> _address specify a type, which must expand to MLton.Pointer.t, so that
> one can import the addresses at opaque types.

Ok, does the same apply for _import * and _store *?

> One other nice thing about the above is that it is, I believe,
> strictly an extension of our currently documented FFI.

That was my intention. ;)

Henry said:
> I don't like the idea that _import would do a fetch immediately for
> non-arrow types but delay it to the call for arrow types (if I understood
> that correctly).

This is how it works right now; I was proposing to *not* change it.
I think _import, though confusing and different at the implementation level,
matches what most programmers would expect it to do...

-- 
Wesley W. Terpstra