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

Structural equality should treat exception specifically #4765

Closed
vicuna opened this issue Apr 6, 2009 · 4 comments

Comments

Projects
None yet
2 participants
@vicuna
Copy link

commented Apr 6, 2009

Original bug ID: 4765
Reporter: till
Assigned to: @alainfrisch
Status: closed (set by @xavierleroy on 2015-12-11T18:25:17Z)
Resolution: fixed
Priority: normal
Severity: feature
Version: 3.11.0
Target version: 4.02.0+dev
Fixed in version: 4.02.0+dev
Category: ~DO NOT USE (was: OCaml general)
Monitored by: @bobzhang abdallah mehdi @glondu @yakobowski

Bug description

let e = Not_found
let eq = function Not_found -> true | _ -> false
exception Not_found
let _ = e = Not_found (* True )
let _ = eq Not_found (
False *)

Additional information

IMHO The pattern matching behaviour seems to be the correct one. I guess the fix would be to change the equality function to handle exceptions specifically (i.e. do pointer equality on the first field).
This might require adding a new tag number for exceptions to be able to tell them apart at run time.

@vicuna

This comment has been minimized.

Copy link
Author

commented Aug 2, 2012

Comment author: @xavierleroy

As the reporter says, significant changes in the representation of exceptions are required to address this issue: either reserve a new tag for by-address comparison, or use Object-tagged blocks for exceptions. Postponing to the next major release (optimistically).

@vicuna

This comment has been minimized.

Copy link
Author

commented Jul 9, 2013

Comment author: @alainfrisch

Postponing again.

@vicuna

This comment has been minimized.

Copy link
Author

commented Oct 23, 2013

Comment author: @alainfrisch

Commit 14239 on the raise_variants branch modifies the representation of exception slots, reusing the existing unique id machinery from object values.

@vicuna

This comment has been minimized.

Copy link
Author

commented Nov 13, 2013

Comment author: @alainfrisch

raise_variants branch has been merged into trunk (rev 14289).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.