Replies: 4 comments 9 replies
-
Thanks for writing this up. I'm putting my thinking cap on and seeing if this is sufficiently sound. I think a big issue is how sloppy the language is in discriminating between a new type vs an alias. Though perhaps that's ok in a structurally (distinguished by structure) typed language which Nim really isn't and it's more nominal (distinguished by name). My understanding is as follows, structural equivalence can represent nominal equivalence by saying that the type (not memory, but the thing in the type expression language) has the name a part of the type itself. This means two otherwise equivalent structures with differing names will not match. So the type So the above approach is a hybrid of nominal and structural and I'm concerned that's not sound or were not thinking of edge cases. Imma as my type system friend for advice. |
Beta Was this translation helpful? Give feedback.
-
Discussed with @j14159, they pointed out that this will result in an error:
The issue being that we lose type information. It's not the worst, but didn't feel great either. |
Beta Was this translation helpful? Give feedback.
-
I think that |
Beta Was this translation helpful? Give feedback.
-
Here is a crazy idea that I came up with: How about we get rid of type aliases altogether and replace them with weak distincts? And a small amendment to the weak distinct rule:
|
Beta Was this translation helpful? Give feedback.
-
Generic aliases are practically useless, the idea here is to make them a weak distinct.
Take the following example:
The rules of this are as follows:
type A[T] = SomeType
Beta Was this translation helpful? Give feedback.
All reactions