Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Why must types be always defined at the top level?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Dave Berry <daveberry@b...>
Subject: Re: [Caml-list] Why must types be always defined at the top level?
At 00:23 25/06/2004, Brian Hurt wrote:
>On Thu, 24 Jun 2004, Xavier Leroy wrote:
> > As to whether equality should be defined on floats, there are pros and
> > cons.  My standpoint is that it's eventually better to stick to
> > established standards (that is, IEEE float arithmetic) rather than try
> > to reinvent a wheel likely to be even squarer than these standards.
> > Prof. Kahan found it worthwhile to fully define equality over floats;
> > I'll abide by his wisdom.
>
>There are legitimate reasons to want floating point equality.  It's
>generally not what you want, but I had an example of needing it in Ocaml
>just the other day.

FWIW, the SML Basis does define an equality operation on IEEE floats.  But 
IEEE equality is not structural equality and so IEEE floats are not 
equality types.  IMO this is a good thing because anyone using equality on 
IEEE floats must understand the difference between IEEE equality and 
structural equality.  It is also a good thing that SML floats are not 
equality types because it encourages people to think twice before using 
equality on floats.  Sometimes you do want equality; often you don't.

I am not trying to criticise Ocaml here, just to clarify the position in SML.

Dave.

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners