Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] On the equality of functional values
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: jeanmarc.eber@l...
Subject: Re: [Caml-list] On the equality of functional values
documentation from pervasives.mli (3.06): 
 
Look, in particular, at the use of the word "may": 
 
external ( = ) : 'a -> 'a -> bool = "%equal" 
(** [e1 = e2] tests for structural equality of [e1] and [e2]. 
   Mutable structures (e.g., references and arrays) are equal 
   if and only if their current contents are structurally equal, 
   even if the two mutable objects are not the same physical object. 
   Equality between functional values may raise [Invalid_argument]. 
   Equality between cyclic data structures may not terminate. *) 
 
Jean-Marc Eber 
 
 
Quoting Alessandro Baretta <alex@baretta.com>: 
 
>  
>  
> David Monniaux wrote: 
> > On Sun, 27 Oct 2002, Alessandro Baretta wrote: 
> >  
> >  
> > If I remember well, = is implemented by doing first a == (equality of 
> > pointers) test, and returning true if that test succeeds; otherwise, 
> > the more complex recursive equality test is performed, which fails 
> with 
> > an exception if it encounters functional values. 
> >  
> > So if x and y are the same closure, x=y succeeds and yields the true 
> > value. Otherwise, it throws an exception. 
>  
> This is what I suspected. I wonder if this behavior conforms  
> to specification, or if it is an incidental concequence of  
> the implementation of (=). 
>  
> Alex 
>  
> ------------------- 
> 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 
>  
-------------------
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