Generics vs Sum Types #16490
Answered
by
Wajinn
eptx
asked this question in
Questions and Answers
Generics vs Sum Types
#16490
-
Example 1 below fails as it looks like matching on primitives with generics is not available? Is this expected behavior or just not implemented yet? Example 2 succeeds using Sum types. What other considerations are there when designing with Vlang generics vs sum types?
|
Beta Was this translation helpful? Give feedback.
Answered by
Wajinn
Nov 20, 2022
Replies: 1 comment 2 replies
-
Hmmm... Vlang's sum types are already doing what you wish generics in Vlang to do (in the example), so the user is not missing that functionality. Additionally, what you appear to want to do with the generics example, can presently be done as below.
|
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
eptx
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hmmm... Vlang's sum types are already doing what you wish generics in Vlang to do (in the example), so the user is not missing that functionality. Additionally, what you appear to want to do with the generics example, can presently be done as below.