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
Aliased exn type is not extensible #9147
Comments
This behavior is not specific to type u = exn = ..
type u += A of int This should be precised in more detail in the manual. |
I find the behavior a bit surprising; when is it the right thing to do to close extensibility on aliasing, and why is it the default? (Could we have a syntax for closing extensibility if the other option was the default?). I tend of think of |
How is that different from not reexporting labels / constructors? |
The behaviour is indeed modeled on the behaviour of records and variants: # type t = T;;
type t = T
# type s = t;;
type s = t
# type r = s = T;;
Line 1, characters 0-14:
1 | type r = s = T;;
^^^^^^^^^^^^^^
Error: This variant or record definition does not match that of type s
Their kinds differ.
# type r = t = T;;
type r = t = T |
If I understand it correctly, your point is the following. If you alias a variant type, you don't automatically get the variant constructors in scope, you still have to go through old type to access them (and old-type-variants are compatible with the alias type). With exensible types, you don't automatically get the power to extend the lias, you still have to go through the old type to extend it (and newly-extended constructors are compatible with the alias type). |
Is there any action required here? I'd like to close this report. |
This is the intended behaviour and I don't think there is a strong reason to change it, so I'm closing. |
Note I think it is actually more helpful to make exn distinct from open types (exn is important), but this inconsistency is intentional?
The text was updated successfully, but these errors were encountered: