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: 5625 Reporter: thelema Assigned to:@garrigue Status: closed (set by @xavierleroy on 2015-12-11T18:04:48Z) Resolution: not a bug Priority: normal Severity: feature Version: 3.12.1 Category: ~DO NOT USE (was: OCaml general)
Bug description
An exception can be defined as equal to another exception:
exception-definition ::= exception constr-name = constr
But within a .mli file, one cannot expose this equality:
specification ::= exception constr-decl
Steps to reproduce
add:
exception Empty = Stack.Empty
to a .mli file
Additional information
Batteries has use for "exception Empty = Stack.Empty" in our batStack.mli file, otherwise we'll have a BatStack.Empty and a Stack.Empty that aren't the same. We could remove the exception from the .mli file, but then it wouldn't be in the documentation as it should, and the test that (BatStack : module type of Stack) would fail, and would need... hmm, I don't think that the exception can be removed from the module type. But that's another issue.
The text was updated successfully, but these errors were encountered:
There is a confusion here.
An exception constructor is just a value, that you can re-export at the value level using the "exception E = " construct.
There is no need to show the sharing in the interface: they are identical at the value level.
A new exception value is created each time you refer to the exception constructor, so you get physically different values (and == returns false).
"=" is also not very good on exceptions, as it compares only the name of the constructors (as strings) and, if they match, the arguments (even if they have different types).
Original bug ID: 5625
Reporter: thelema
Assigned to: @garrigue
Status: closed (set by @xavierleroy on 2015-12-11T18:04:48Z)
Resolution: not a bug
Priority: normal
Severity: feature
Version: 3.12.1
Category: ~DO NOT USE (was: OCaml general)
Bug description
An exception can be defined as equal to another exception:
exception-definition ::= exception constr-name = constr
But within a .mli file, one cannot expose this equality:
specification ::= exception constr-decl
Steps to reproduce
add:
to a .mli file
Additional information
Batteries has use for "exception Empty = Stack.Empty" in our batStack.mli file, otherwise we'll have a BatStack.Empty and a Stack.Empty that aren't the same. We could remove the exception from the .mli file, but then it wouldn't be in the documentation as it should, and the test that (BatStack : module type of Stack) would fail, and would need... hmm, I don't think that the exception can be removed from the module type. But that's another issue.
The text was updated successfully, but these errors were encountered: