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

Redefinition of exceptions, matching and equality are odd #4531

Closed
vicuna opened this issue Apr 9, 2008 · 2 comments
Closed

Redefinition of exceptions, matching and equality are odd #4531

vicuna opened this issue Apr 9, 2008 · 2 comments

Comments

@vicuna
Copy link

vicuna commented Apr 9, 2008

Original bug ID: 4531
Reporter: fpessaux
Status: closed (set by @xavierleroy on 2013-08-31T10:46:09Z)
Resolution: suspended
Priority: normal
Severity: major
Version: 3.10.1
Category: ~DO NOT USE (was: OCaml general)
Duplicate of: #3441
Monitored by: @glondu

Bug description

I know, it' evil to re-define things, but... ;)

exception Foo of int ;;
let x = Foo 0 ;;
exception Foo of bool ;;
let y = Foo false ;;
x = y ;;
-----> . Pretty strange since arguments do not have the same type.

x == y ;;
-----> . Right, mostly satisfactory.

match x with
| Foo a -> false
| whatever -> whatever = x && whatever = y
;;
Result is . This means that it appears that the match "knew" that x was defined using the now "masked" constructor Foo, hence do not take the first case. However, the second case when taken, reveals that x is not "matchingly" equal to an (certain) Foo but is equal to ... both.

Where am I wrong ?

@vicuna
Copy link
Author

vicuna commented Apr 9, 2008

Comment author: @alainfrisch

Cf the discussion after bug #1248.

@vicuna
Copy link
Author

vicuna commented Jan 25, 2012

Comment author: @damiendoligez

See #3441 for the status of this problem.

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

No branches or pull requests

1 participant