Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005186OCamlOCaml generalpublic2010-12-01 16:332013-07-19 11:24
ReporterJulien Signoles 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionno change required 
PlatformOSOS Version
Product Version3.11.2 
Target Version4.01.0+devFixed in Version 
Summary0005186: Exception aliasing does not preserve abstraction
DescriptionHello,

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

let () =
  try f ()
  with
  | 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
(0008114)
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.
(0009809)
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


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker