From: Markus Mottl <mottl@miss.wu-wien.ac.at>
To: Pierre.Weis@inria.fr (Pierre Weis)
Subject: Re: Bug converting numbers?
Date: Mon, 14 Sep 1998 11:13:56 +0100 (MET DST) [thread overview]
Message-ID: <199809140913.LAA16970@miss.wu-wien.ac.at> (raw)
In-Reply-To: <199809140741.JAA09810@pauillac.inria.fr> from "Pierre Weis" at Sep 14, 98 09:41:21 am
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 *
prev parent reply other threads:[~1998-09-14 9:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-09-12 13:22 Markus Mottl
1998-09-14 7:41 ` Pierre Weis
1998-09-14 10:13 ` Markus Mottl [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=199809140913.LAA16970@miss.wu-wien.ac.at \
--to=mottl@miss.wu-wien.ac.at \
--cc=Pierre.Weis@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox