[MLton] Bug with "polymorphic" exns

Stephen Weeks MLton@mlton.org
Mon, 24 Jan 2005 21:24:54 -0800


> the point is that the type of the let expression (namely, unit) does
> not mention the type variable.  Hence, the consequent:
>
> C |- val 'a x = let exception E of 'a in () end => VE' in Env
> 
> is derivable by Rule 15
...

Thanks for the detailed explanation and examples.  They all made
sense.  MLton is buggy in two respects:

1. It rejects expansive valbinds that explicitly bind type variables,
   whether or not type variables appear in the type.

2. It treats every valbind as expansive if any of the right-hand sides
   are, when it should treat each "<pat> = <exp>" separately.  For
   example, it incorrectly rejects

	val f = fn x => x
	and r = ref 13
	val _ = (f 1; f true);

I've looked at the front end and think there is a reasonably simple
fix to these problems, but I want to sleep on it before putting it
in.  I hope to report a bugfix tomorrow.