remove-unused

Stephen Weeks MLton@sourcelight.com
Fri, 26 Oct 2001 12:36:47 -0700


> The rewrite of the return cont and handler is o.k. with the
> terminate flag interpreted as may terminate.  (i.e., we can drop the
> existing continuation when the callee cannot terminate,

makes sense

> and either replace it with a bug continuation (if we need to
> preserve the handler,

makes sense

> or if type checking prevents us from making a non-tail call to
                                                ^^^^^^^^
do you mean tail call?

> non-terminating, non-failing function (i.e., an infinite loop)) or a
> tail call (if types match up)).

I am still confused about the fourth clause in the translation of Call.

			    | (false, _, _)
			    => if Vector.forall
			          (returnsFunc f, 
				   fn (x, t) => not (isUsedVar x))
				 then call NONE
				 else call (SOME {cont = getBugContFunc 
						         (f, returnsFunc func), 
						  handler = NONE}))

I don't understand why ensuring that this function doesn't return any
values means that the "types match up".  Don't we also have to check
that the callee (i.e. func) doesn't return any values?