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] Functor implementation
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: brogoff@s...
Subject: Re: [Caml-list] Functor implementation
On Wed, 23 Jul 2003, Chris Clearwater wrote:
> Ahh, thanks, functors now fit nicely in my head. And yeah that cmp
> function was kind of braindead. I dont know why I didnt simply write it
> as : let cmp x y = if x > y then GT else if x < y then LT else EQ. But
> it would still be nice if the built in comparison function returned a
> sum type. 

I agree. I think I made a petty complaint about this some time ago. And 
I'd make another (even more petty) complaint about your choice of constructor 
names now, as I'd prefer Equal, LessThan, GreaterThan or Eq, Lt, Gt, so that 
all caps names could be reserved by convention for module types and "view" 
constructor names. By view constructors, I'm referring to the technique 
described by Wang and Murphy for simulating views in ML; that technique is 
even better in OCaml with private types, though I suspect that we'd pay more 
for the indirections than would MLton users. 

> Maybe "ordering" is a more appropriate name. Also, true and false appear
> to be a sum type: type bool = True | False, except you can't have lower
> case constructor names. Does this signal the fact that there is some
> kind of limitation with having primitive sum types?

Nope, probably hysterical raisins again. Note that Revised fixes this. 

-- Brian

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