[MLton] Re: PackWord to/from nonsense

Matthew Fluet fluet at tti-c.org
Wed Jul 8 08:38:15 PDT 2009


On Wed, 8 Jul 2009, Wesley W. Terpstra wrote:
> I had an even better approach:
>  type int = FixedInt.int option * int
> Whenever a calculation is performed, the FixedInt is ignored and set NONE in
> the result.
>
> I'm quite confident that MLton would have been able to optimize the unused
> parts away in nearly all cases. If you take an IntInf.int and operate on it,
> you ignore the FixedInt part so it is dropped as an argument. Similarly, if
> you are just using IntInf for a conversion, the int part is not needed and
> dropped.

I think you are right about MLton being able to drop the useless component 
of the tuple.

> Unfortunately, this doesn't quite work because IntInf.int has to be an
> eqtype. Is there any way to instruct MLton to ignore the FixedInt part of
> the tuple when comparing these types?

No, unless you bake in to the compiler as a primitive type.



More information about the MLton mailing list