From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA18823 for caml-redistribution; Mon, 14 Sep 1998 11:35:32 +0200 (MET DST) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id LAA18504 for ; Mon, 14 Sep 1998 11:14:05 +0200 (MET DST) Received: from miss.wu-wien.ac.at (miss.wu-wien.ac.at [137.208.107.17]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id LAA08868 for ; Mon, 14 Sep 1998 11:14:04 +0200 (MET DST) Received: (from mottl@localhost) by miss.wu-wien.ac.at (8.9.0/8.9.0) id LAA16970 for Pierre.Weis@inria.fr; Mon, 14 Sep 1998 11:13:56 +0200 (MET DST) From: Markus Mottl Message-Id: <199809140913.LAA16970@miss.wu-wien.ac.at> Subject: Re: Bug converting numbers? To: Pierre.Weis@inria.fr (Pierre Weis) Date: Mon, 14 Sep 1998 11:13:56 +0100 (MET DST) In-Reply-To: <199809140741.JAA09810@pauillac.inria.fr> from "Pierre Weis" at Sep 14, 98 09:41:21 am X-Mailer: ELM [version 2.4 PL21] MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Sender: weis Hello - Bonjour! > The problem here is that you missed the right equality predicate: you > must use = instead of ==. Remember that == means unicity of > representation, not semantical equality of values. For instance: > Remember that the == predicate is not for casual uses: you should know > something about value representations in your Caml system to use it > safely. In doubt, use the regular = predicate. Ah, everything clear! Having programmed in other languages lately, where '==' means semantical equality, I easily read over this bug, although I knew that there exist two operators for testing semantic equality or representational identity respectively in Ocaml. Especially, because: # 1 == 1;; - : bool = true but # 1.0 == 1.0;; - : bool = false This is certainly not, what the casual Ocaml-user expects... Since there are probably many Ocaml-users who also use languages where '==' expresses semantic equality (C/C++ is not the only one - e.g. Haskell also uses this operator), wouldn't it be a good idea to take a different operator than '==' for checking representational identity? As I had to realize, such bugs can be really hard to track down. And since this operator is probably not so often in use in "normal" Ocaml-programs, it would not really effect too many developers. Best regards, Markus Mottl français: Beaucoup de programmeurs en Ocaml aussi écrivent aux langues ou '==' exprime l'égalité sémantique. Ne serait-il pas une bonne idée de prendre un operateur différent en place de "==" pour exprimer l'identité de représentation en Ocaml? Comme je ai du voir, il peut être très difficile de trouver des erreurs de cette sorte. Parce-que ce n'est pas un operateur souvant utilisé, je ne crois pas que ce changement aie un effet fort aux developeurs. Amicalement, Markus Mottl -- * Markus Mottl | University of Economics and * * Department of Applied | Business Administration * * Computer Science | Vienna, Austria * * mottl@miss.wu-wien.ac.at | http://miss.wu-wien.ac.at/~mottl *