You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 5186 Reporter: Julien Signoles Status: closed (set by @xavierleroy on 2015-12-11T18:21:04Z) Resolution: not a bug Priority: normal Severity: minor Version: 3.11.2 Target version: 4.01.0+dev Category: ~DO NOT USE (was: OCaml general) Monitored by:@glondu till @hcarty@Chris00@yakobowski
Bug description
Hello,
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) :-(.
The text was updated successfully, but these errors were encountered:
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.
"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.
Original bug ID: 5186
Reporter: Julien Signoles
Status: closed (set by @xavierleroy on 2015-12-11T18:21:04Z)
Resolution: not a bug
Priority: normal
Severity: minor
Version: 3.11.2
Target version: 4.01.0+dev
Category: ~DO NOT USE (was: OCaml general)
Monitored by: @glondu till @hcarty @Chris00 @yakobowski
Bug description
Hello,
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) :-(.
The text was updated successfully, but these errors were encountered: