Skip to content
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

Allow Maybe{T} typealias #3332

Closed
Keno opened this issue Jun 8, 2013 · 13 comments
Closed

Allow Maybe{T} typealias #3332

Keno opened this issue Jun 8, 2013 · 13 comments

Comments

@Keno
Copy link
Member

Keno commented Jun 8, 2013

Jeff noted that

typealias Maybe{T} Union(T,Nothing)

and things like it can probably be easily implemented. Just noting it here, so we don't forget about it.

@toivoh
Copy link
Contributor

toivoh commented Jun 8, 2013

+1

2 similar comments
@ViralBShah
Copy link
Member

+1

@amitmurthy
Copy link
Contributor

+1

@bsxfan
Copy link

bsxfan commented Jun 9, 2013

Has anyone ever thought of overloading | for types, so that one could use for example MyType | Nothing as a terse shortcut for Union(MyType,Nothing)?

@StefanKarpinski
Copy link
Member

That has occurred to me many times but I was afraid of the wrath of Bezanson. Bezanson!! But seriously, it might be ok but we generally want to avoid a lot of puns on operators.

@Keno
Copy link
Member Author

Keno commented Jun 10, 2013

Note that that conflicts with using | as a piping operator (though we're probably gonna use |> anyway).

@quinnj
Copy link
Member

quinnj commented Dec 17, 2013

I believe #5164 closes this?

@pao
Copy link
Member

pao commented Dec 17, 2013

I'm not seeing the connection--do you mind spelling it out for my coffee-deprived brain?

@quinnj
Copy link
Member

quinnj commented Dec 17, 2013

Hmmm.......I thought I remember seeing something about allowing any immutable as a type parameter, and thought this pull request did it, but perhaps it was more focused on just tuples. In any case, I ran the code at the top and it seems to work, so maybe this was closed by something else before?

@porterjamesj
Copy link
Contributor

That PR was just about tuples. The code above worked fine before; it just wasn't (and still isn't) in Base.

@quinnj
Copy link
Member

quinnj commented Dec 17, 2013

I guess I'm misunderstanding the purpose of this issue then. I thought it was because the above code wasn't legal (hence the "Allow this typealias..."). If it's just to include the Maybe{T} typealias in Base, then sorry for the noise.

@Keno
Copy link
Member Author

Keno commented Aug 8, 2014

No, I believe it originally didn't work. Seems to be fixed now.

@Keno Keno closed this as completed Aug 8, 2014
@andrewcooke
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants