-
Notifications
You must be signed in to change notification settings - Fork 0
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
Abstract Union Types #2
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Since I already implemented julia-style abstract types, I may as well implement union types. The easy way would be to just create a variant of
TypeMatch
that matches against multiple types and have the matched argument inferred asValue
, which will result in the following semantics:But I wonder if it wouldn't be better if two methods were created, one where
x
is ai32
and another wherex
is ai64
... That might be too tricky to handle even from the user's perspective, actually; in the above case, you would need to choose a return type that will work for both. One could convert x toi64
in this case because it's sort of a supertype, but if one had say aUnion![f32, i64]
this wouldn't work. One could convertx
toValue
but then that's just the first implementation, but more verbose. (Well, it's also opt-in...)HMMMM...
The text was updated successfully, but these errors were encountered: