[MLton] Conversions and the Basis Library

Wesley W. Terpstra wesley at terpstra.ca
Wed Nov 28 12:11:56 PST 2007


On Nov 28, 2007, at 8:36 PM, Vesa Karvonen wrote:
> On Nov 28, 2007 8:04 PM, Wesley W. Terpstra <wesley at terpstra.ca>  
> wrote:
>> On Nov 28, 2007, at 6:25 PM, Vesa Karvonen wrote:
>>> val convert1 = Int64.fromFixed o IntX.toFixed
>>> val convert2 = Int64.fromFixed o Real.toFixedInt IEEReal.TO_ZERO
>>
>> This is what we all do in practice ATM anyway.
>
> "Let's get back to first principles...standards have historically
> played two roles in our industry. The first role has been to codify
> what is already common practice in the industry. Such standards are
> attempts to capture what everyone is already doing, perhaps ironing
> out some minor inconsistencies along the way."

You've convinced me that this is a good thing to add. My last comment  
is a pragmatic one: is it easier to advocate a change to the basis or  
to patch MLton's optimizer?

I know your answer; you've already undertaken to rewrite the basis.  
I've come to consider the later easier.

> val AtoB =
>  if isSome A.maxInt
>  then B.fromFixedInt o A.toFixedInt
>  else B.fromLargeInt o A.toLargeInt

Fair enough.

>> Weren't you the one talking about the Genius Tailor? ;-)
> Yes.  The lesson of the story is that you need to think and not accept
> things as they are.


I thought the lesson was that a language shouldn't force programmers  
to distort code to fit it.




More information about the MLton mailing list