Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: Non generalizable type of constants?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Pierre Weis <Pierre.Weis@i...>
Subject: Re: Non generalizable type of constants?
> > I'm not aware of any solution to your problem, except turning your
> > unit_bad identifier into a function let unit_bad () = A.atom (M.unit).
> 
> Syntactically, It's not pretty, but I can live with it.  I shied away
> from this because I was not sure about the result of
> 
>   module F = FreeRing ( some ring ...)
>   compare (F.unit_bad ()) (F.unit_bad ())
> 
> in this case.  Does O'Caml guarantee that the expression will always
> evaluate to 0?  [ Currently it appears to, but can I depend on it? ]

Yes, since constant constructors are uniquely represented.

Best regards,

Pierre Weis

INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://cristal.inria.fr/~weis/