Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005186OCaml~DO NOT USE (was: OCaml general)public2010-12-01 16:332015-12-11 19:21
ReporterJulien Signoles 
Assigned To 
StatusclosedResolutionno change required 
PlatformOSOS Version
Product Version3.11.2 
Target Version4.01.0+devFixed in Version 
Summary0005186: Exception aliasing does not preserve abstraction

Consider the following program:
exception A
let f () = raise A
module M : sig exception B end = struct exception B = A end

let () =
  try f ()
  | M.B -> Format.printf "M.B@."
  | A -> Format.printf "A@."

The output is "M.B" since M.B matches before A. That is consistent with the dynamic semantics of exception aliasing and pattern matching (as far as I understand it) BUT it does not preserve abstraction since the interface of M does not say that M.B is an alias for A. Thus an external user of M cannot expect this behavior.

Sadly, I see no way to circumvent this issue (except to add a textual documentation to the interface of M) :-(.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
doligez (administrator)
2012-09-19 14:26

I'm not sure this should be considered a bug. Note that the interface of M does not say that M.B is NOT an alias for A, so maybe you shouldn't be surprised when it is.
xleroy (administrator)
2013-07-19 11:24

"exception A" in a signature doesn't imply that "A" is fresh, just that it is an exception constructor. I agree this can be counter-intuitive, but I don't see anything that can be done about it.

- Issue History
Date Modified Username Field Change
2010-12-01 16:33 Julien Signoles New Issue
2011-05-17 20:22 doligez Status new => acknowledged
2012-07-10 17:29 doligez Target Version => 4.01.0+dev
2012-07-31 13:36 doligez Target Version 4.01.0+dev => 4.00.1+dev
2012-09-19 14:26 doligez Note Added: 0008114
2012-09-19 14:26 doligez Status acknowledged => confirmed
2012-09-19 14:26 doligez Target Version 4.00.1+dev => 4.01.0+dev
2013-07-19 11:24 xleroy Note Added: 0009809
2013-07-19 11:24 xleroy Status confirmed => resolved
2013-07-19 11:24 xleroy Resolution open => no change required
2015-12-11 19:21 xleroy Status resolved => closed
2017-02-23 16:36 doligez Category OCaml general => -OCaml general
2017-03-03 17:55 doligez Category -OCaml general => -(deprecated) general
2017-03-03 18:01 doligez Category -(deprecated) general => ~deprecated (was: OCaml general)
2017-03-06 17:04 doligez Category ~deprecated (was: OCaml general) => ~DO NOT USE (was: OCaml general)

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker