Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug in structural equality #3322

Closed
vicuna opened this issue Dec 1, 2004 · 2 comments
Closed

bug in structural equality #3322

vicuna opened this issue Dec 1, 2004 · 2 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Dec 1, 2004

Original bug ID: 3322
Reporter: administrator
Status: closed
Resolution: not a bug
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Related to: #4715

Bug description

Full_Name: Daniel Weil
Version: 3.08.2
OS: Windows
Submission from: 81.80.88.226 (81.80.88.226)

There is a difference of behavior between 3.07 and 3.08 release of OCaml if you
type this in the Ocaml interpreter:

type t = {a : t};;
let rec x = {a = x};;
x = x

In 3.07, compiler terminates and answer true

In 3.08, compiler never terminates!!!

Which compiler has the right answer ?

@vicuna
Copy link
Author

vicuna commented Dec 9, 2004

Comment author: administrator

type t = {a : t};;
let rec x = {a = x};;
x = x

In 3.07, compiler terminates and answer true

In 3.08, compiler never terminates!!!

Which compiler has the right answer ?

Both. The specification of (=) has changed slightly between 3.07 and 3.08.
In 3.07, "Equality between cyclic data structures may not terminate."
In 3.08, "Equality between cyclic data structures does not terminate."

Note that the 3.08 spec is included in 3.07, so any program that was correct
in 3.07 is still correct in 3.08. But the 3.08 behaviour exposes some bugs in
your programs that were hidden by 3.07.

There is in 3.08 a function that has the same behaviour (=) had in 3.07:
Pervasives.compare.

-- Damien

@vicuna vicuna closed this as completed Dec 9, 2004
@vicuna
Copy link
Author

vicuna commented Dec 10, 2004

Comment author: administrator

C'est ce que j'ai remarqué dans la doc CAML mais il faudrait peut-être le
mentionner plus explicitement dans le fichier "Changes" des sources OCAML.

Le problème en effet est que c'est trop tard si on detecte le bug à
l'execution, on veut le trouver à la compil.

La solution que j'ai choisit , c'est de surcharger le module Pervasives en
masquant le "=" et le remplaçant par un opérateur "=*" ce qui permet par
un grep de le repérer facilement dans nos 50000 lignes de code, puis de
compiler tous nos modules OCAML avec l'option -nopervasives!

Est-ce qu'il y aurait un moyen à la compil et non à l'exécuction de
detecter des bugs potentiels et d'affichier un warning quand le "=" est
utilisé sur des structures potentiellement récursives ?

Daniel Weil

Damien Doligez caml-bugs@pauillac.inria.fr
12/09/2004 03:14 PM

A
daniel_weil@ds-fr.com
cc

Objet
Re: bug in structural equality (#3322)

type t = {a : t};;
let rec x = {a = x};;
x = x

In 3.07, compiler terminates and answer true

In 3.08, compiler never terminates!!!

Which compiler has the right answer ?

Both. The specification of (=) has changed slightly between 3.07 and
3.08.
In 3.07, "Equality between cyclic data structures may not terminate."
In 3.08, "Equality between cyclic data structures does not terminate."

Note that the 3.08 spec is included in 3.07, so any program that was
correct
in 3.07 is still correct in 3.08. But the 3.08 behaviour exposes some
bugs in
your programs that were hidden by 3.07.

There is in 3.08 a function that has the same behaviour (=) had in 3.07:
Pervasives.compare.

-- Damien



C'est ce que j'ai remarqué dans la doc
CAML mais il faudrait peut-être le mentionner plus explicitement dans le
fichier "Changes" des sources OCAML.



Le problème en effet est que c'est trop
tard si on detecte le bug à l'execution, on veut le trouver à la compil.



La solution que j'ai choisit , c'est
de surcharger le module Pervasives en masquant le "=" et le remplaçant
par un opérateur "=*" ce qui permet par un grep de le repérer
facilement dans nos 50000 lignes de code, puis de compiler tous nos modules
OCAML avec l'option -nopervasives!



Est-ce qu'il y aurait un moyen à la
compil et non à l'exécuction de detecter des bugs potentiels et d'affichier
un warning quand le "=" est utilisé sur des structures potentiellement
récursives ?



Daniel Weil







Damien Doligez <caml-bugs@pauillac.inria.fr>

12/09/2004 03:14 PM

A
daniel_weil@ds-fr.com
cc
Objet
Re: bug in structural equality (#3322)





> type t = {a : t};;
> let rec x = {a = x};;
> x = x
>
> In 3.07, compiler terminates and answer true
>
> In 3.08, compiler never terminates!!!
>
> Which compiler has the right answer ?

Both.  The specification of (=) has changed slightly between 3.07 and 3.08.
In 3.07, "Equality between cyclic data structures may not terminate."
In 3.08, "Equality between cyclic data structures does not terminate."

Note that the 3.08 spec is included in 3.07, so any program that was correct
in 3.07 is still correct in 3.08.  But the 3.08 behaviour exposes some bugs in
your programs that were hidden by 3.07.

There is in 3.08 a function that has the same behaviour (=) had in 3.07:
Pervasives.compare.

-- Damien



---------------- ----------------

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant