Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Design advice
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-09-28 (22:55)
From: Chris Hecker <checker@d...>
Subject: Re: [Caml-list] Design advice

>    let suit_to_int = function
>       | Spades   -> 0
>       | Hearts   -> 1
>       | Diamonds -> 2
>       | Clubs    -> 3
>?  You only have to type it once, and if you change the constructors
>around, it won't even compile.

As I mentioned in my mail,

    let suit_to_int = function
       | Spades   -> 0
       | Hearts   -> 1
       | Diamonds -> 1
       | Clubs    -> 3

is a bug that the compiler can't find.  That's why I said it was a 
tradeoff.  Also, having to type the constructors twice in the mli and the 
ml is already a huge pain the ass for maintenance and refactoring in my 
opinion, and having to do it a third time is completely lame.  But yes, 
magic is magic, so that's why I didn't say it was absolutely the right 
thing.  In reality, a ton of C code depends on this and it is documented to 
work like this in the manual, so it's probably safe, but I don't like 
fencing in the compiler folks any more than necessary.  Hence, "choose your 


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: