29/11/13 13:47, David Matthews wrote:
The ML standard is not specific about what the "program context" should
be when disambiguating flexible records and overloading. Poly/ML uses
as wide a context as possible but that can mean that a program that
compiles with Poly/ML won't necessarily compile with other
implementations. I've added a switch
PolyML.Compiler.narrowOverloadFlexRecord that defaults to false. If set
to true the compiler uses a much narrower context; essentially the val
binding.
I've looked at a few other implementations to see what they do. The
most restrictive is Hamlet which corresponds to what Poly/ML now does
with narrowOverloadFlexRecord set to true. It rejects
let fun f x y = x + y in f 1.0 end;
which SML/NJ (110.74) accepts. Neither accept
let fun f {x, ...} = x in f {x=1} end;
Mlton seems to use the whole program context as Poly/ML does.
There was a discussion about this on the MLton mailing list while ago
and MLton now has an annotation to control the context used:
http://thread.gmane.org/gmane.comp.lang.ml.mlton.user/1335/focus=6086
http://sourceforge.net/p/mlton/code/7618/
I thought MLton's default value for this annotation (equivalent to its
previous behaviour) caused a narrower context than PolyML, so I have
been using
-default-ann 'resolveScope topdec'
to get (nearly) equivalent behaviour between the compilers.
Phil
_______________________________________________
polyml mailing list
[email protected]
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml