[MLton] Unicode / WideChar

Stephen Weeks MLton@mlton.org
Mon, 21 Nov 2005 20:54:00 -0800

> Hence we are reduced to the usual problem: what do we do when we
> have a definition that naturally is a partial function?  We can
> either make it total (by `arbitrarily' defining it in the other
> case) or we can leave it partial by raising an exception in the
> cases when its argument doesn't apply.  (Actually, theoretically,
> there is also a 3rd possibility: to not terminate on the `undefined'
> cases.)  The definition in the CHAR signature says that for such
> things, it returns its argument unchanged.  I don't see that as an
> unreasonable choice, but I don't feel strongly about it.

It seems to me that raising an exception or returning an option is a
much better choice in such a situation.  If you extend via the
identity function, one cannot distinguish programmatically between
cases that really should be the identity and cases that are part of
the extension.