[MLton] Callback to function pointer?

Matthew Fluet fluet@cs.cornell.edu
Tue, 12 Jul 2005 16:24:23 -0400 (EDT)

> > Now, if you don't want to leave SML to get the address of an "_export"ed 
> > function, then that is currently supported, using an (as of yet 
> > undocumented) feature of MLton FFI.  Essentially,
> > 
> >   _import # "name": MLton.Pointer.t;
> I wonder if "&" would be better than "#" here?
>   _import & "name": MLton.Pointer.t;

"&" would probably be better, but I chose "#" because it was already known 
by the lexer.  Since "&" is a valid SML identifier (and "#" is not), it 
complicates the lexer/parser (admittedly, not by that much).

Another alternative is a different keyword:

  _address "name": MLton.Pointer.t;

> I don't see how you could do much better than this (other than minor
> syntactic improvements).  What Wesley wants is impossible without
> run-time code generation as far as I can see.