[MLton] Question about Definition of SML :)
Anoq of the Sun
Thu, 11 Dec 2003 04:15:55 +0200
Stephen Weeks wrote:
> > > Will you accept or reject
> > >
> > > val x = ref nil
> > I will reject it - due to value-restriction (and the truly "closing closure").
> What prevents the type inference from assigning x the type "int list
> ref", which has no type variables? I don't see how closure can come
> into play here.
Nothing prevents it. However this would be an arbitrary instantiation.
During inference the variable will be free and if the closure
binds all free type variables as parameters for a resulting type
scheme then there is no such arbitrary instantiation.
Hence I would judge it invalid due to value-restriction and the
fact that I insist on binding all free type variables explicitly
at every closure operation.