case expressions/transfers

Matthew Fluet fluet@CS.Cornell.EDU
Thu, 10 Jan 2002 08:13:14 -0500 (EST)


> I just checked in an alternate solution that I think is better, 
> 
> Have a look.

Looks good.  You're right that we just need the number of cons; in the SSA
typechecker I need to check that we're not duplicating anything, but here
we're making that assumption.  

I don't object to moving this to the closure converter; nothing else in
the XML IL requires this invariant and it would save whatever minor
slowdown this is adding to the XML simplifier.  The other advantage is
that the closure converter already decorates each variable with it's type,
although your solution doesn't need to look up the type of the case.

I guess it depends on whether or not we allow datatypes with an empty cons
vector.  If we did, then a case transfer with no branches would be
exhaustive and would not require a default (it would also be unreachable
code and I'm fairly sure the translation into Machine or at codegen would
complain about such a case transfer).  But, I'm happy to accept the claim
that no such datatypes are produced by the monomorphiser and therefore an
empty cases vector is always non-exhaustive.