-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
typealias Maybe{T} Union(T,Nothing) #1134
Comments
This has various problems. If These kinds of unions are ambiguous. Matching One problem is that we use these "type constructors" also as types; you expect to say |
Got it. I'll just close. |
Fortunately, I'm not sure that the Maybe type is all that useful in Julia. You could always add a method for the # like Maybe{Int}
foo(x::Int) = x^2
foo(x::Nothing) = NaN I can think of a few things Maybe should be able to do that this can't, though. Was there a motivating case? |
Sometimes it is useful to define a |
You have that pattern in |
Yeah, this wasn't for a particular reason. I'm content not to have this — as Jeff points out, it doesn't really work for us. |
for people coming from googling "julia maybe type" - there's now Nullable which seems to be similar http://julia.readthedocs.org/en/latest/manual/types/#nullable-types-representing-missing-values |
Can this be made to work? Currently it's an error:
The text was updated successfully, but these errors were encountered: