[MLton] WideChar

Matthew Fluet fluet@cs.cornell.edu
Mon, 13 Dec 2004 19:08:02 -0500 (EST)


> > The problem with both NONE and exceptions for 1.2 style converters is that
> > the invalidity of the input stream is not discovered until sufficient
> > input is read; i.e., not at the point where the conversion is applied.
>
> I read your later comments to Stephen, but didn't really understand them.
>
> Sure, the conversion is applied later, when you actually input from the
> stream, but why is that a problem? Getting a 'NONE' means some conversion
> somewhere in the conversion chain failed; not in the very last conversion.

Either I'm not doing a good job of explaining the issue that I see, or
nobody else thinks it is an issue.

I'm simply noting the software engineering issue of recovering from bad
encodings.  Because the conversion is applied lazily, you need to write
recovery code for every use of the stream.  This recovery can either be
explicit (checking for NONE and/or handling an exception at the use) or
implicit (handling an exception around the whole use of the stream).

Agreed, that getting a 'NONE' means that some conversion failed; the more
conversions, the more ways to fail.

Anyways, I'm happy to let the matter drop.