[MLton] Re: [MLton-commit] r6883

Matthew Fluet fluet at tti-c.org
Tue Sep 30 14:31:13 PDT 2008


On Tue, 23 Sep 2008, Wesley Terpstra wrote:
> When building a library, assume -default-ann "allowFFI true".

> +      (* It doesn't make sense to have a library without FFI *)
> +      val () =
> +         case !format of
> +            Executable => ()
> +          | _ => ignore (Control.Elaborate.processDefault "allowFFI true")
> +

While I agree that it doesn't make sense to build a library that doesn't 
export any functions (and, thus, uses FFI), I don't think that the default 
annotation should be 'allowFFI true'.  Yes, it is a little more concise 
for a one-file *.sml library, but it is an abstraction violation for a 
well-designed, modular, multi-file *.mlb project.  In that setting, you 
would expect a project like:

   foo.mlb (* 'pure' SML *)
   bar.mlb (* 'pure' SML *)
   baz.sml (* 'pure' SML *)
   qux.sml (* 'pure' SML *)
   ann "allowFFI true" in
     export.sml (* export functions *)
   end

Not defaulting to "allowFFI true" ensures that no FFI is used in the 
'pure' SML portions of the library.



More information about the MLton mailing list