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
Type abstraction and (polymorphic) equality
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-06-29 (23:39)
From: brogoff <brogoff@s...>
Subject: Re: [Caml-list] Type abstraction and (polymorphic) equality
On Wed, 29 Jun 2005, Christophe TROESTLER wrote:
> Well I was more thinking of overloading equality in a GCaml manner
> ( which offers you
> more, not less.

That's one way to go about it, though GCaml still provides polymorphic
equality, so if you write your generic function so that there's a
catch all 'a-> 'a -> bool branch which uses that equality, the bug/flaw can
still bite you.

It would be best if GCaml (and OCaml?) do away with polymorphic equality, or
at least give it some ugly name to prevent it's accidental misuse.

Type classes would be another option, but people don't like the redundancy with
the ML module system. Maybe some future ML will be based on type classes and
a simple non-parameterized module system, so

  However, I do not know how much GCaml actually tries
> to reduce the performance hit by compiling monomorphically whenever
> possible...

There's not even a native code compiler yet, so I wouldn't worry to much about
it just now.

-- Brian