Shadowing conformance is unsound? #840
Closed
kyouko-taiga
started this conversation in
Language design
Replies: 1 comment 6 replies
-
I don't see why you say it's unsound. Making the final line legal is not the semantics I envisioned. In my world, |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I think this program demonstrates that shadowing conformance with the semantics we currently envision is unsound:
I think we can fix this problem by saying that types have a scope which can play a role in their equivalence relationship. So
X<Int>
at file scope andX<Int>
inmain
are not equivalent because they capture different conformances in their respective scope.For the sake of sanity, I think we should further demand that a shadowing conformance be a refinement of the conformance it shadows. That way, a conformance cannot invalidate positive deductions that can be made outside of its scope. In the above example, that would mean the nested conformance is illegal.
Or ... we could ban conformance shadowing. AFAICT, it's not the reason why we wanted scoped conformances.
Beta Was this translation helpful? Give feedback.
All reactions