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

RFC: Add isa as an infix operator #19677

Merged
merged 2 commits into from
Dec 29, 2016
Merged

Conversation

ararslan
Copy link
Member

This implements @yuyichao's suggestion in #19524 of an infix operator version of isa. Thus, with this PR, we have

julia> 1 isa Integer
true

@ararslan ararslan changed the title RFC: Add isa as an infix operator WIP: Add isa as an infix operator Dec 22, 2016
@ararslan ararslan changed the title WIP: Add isa as an infix operator RFC: Add isa as an infix operator Dec 22, 2016

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@ararslan
Copy link
Member Author

Any comments? Is this something we want to have?

@tkelman tkelman added the parser Language parsing and surface syntax label Dec 24, 2016
@quinnj
Copy link
Member

quinnj commented Dec 24, 2016

I'm a fan 👍

@nalimilan
Copy link
Member

I always fail to remember the order of arguments to isa; having it infix would fix that.

@StefanKarpinski
Copy link
Member

If this gets the @JeffBezanson go-ahead, we should probably change the usages as well.

@JeffBezanson
Copy link
Member

I won't object --- but it's starting to seem like only a matter of time before we allow infix for any function.

@ararslan
Copy link
Member Author

it's starting to seem like only a matter of time before we allow infix for any function.

Actually I was initially against this change for exactly that reason. But upon further reflection, this just seems to me like a natural infix operator, like <: except for values instead of types.

@JeffBezanson
Copy link
Member

One observation is that both in and isa should obviously have comparison precedence, but for arbitrary functions the precedence is less clear.

@ararslan
Copy link
Member Author

Would this give you any less pause if there were some kind of symbolic infix operator that lowered to isa rather than having isa itself be infix?

@JeffBezanson
Copy link
Member

No, this is fine. I can't think of an operator that would improve on just using isa.

@ararslan
Copy link
Member Author

Okay, cool. Thanks everyone!

@ararslan
Copy link
Member Author

If this is good to merge, does someone want to do the deed?

@oscardssmith
Copy link
Member

Can we also add isan in case the type starts with a vowel?

@JeffBezanson
Copy link
Member

No. English is too weird :)

@vchuravy vchuravy merged commit 4d44668 into JuliaLang:master Dec 29, 2016
@ararslan ararslan deleted the aa/isa-operator branch December 29, 2016 01:34
@tkelman
Copy link
Contributor

tkelman commented Dec 29, 2016

This should go into news since it can change how existing code is parsed

@ararslan
Copy link
Member Author

ararslan commented Dec 29, 2016

Okay, I can submit a PR with a news item.

Edit: Done.

@ranjanan
Copy link
Contributor

ranjanan commented May 15, 2017

@tkelman are you planning to include this in 0.6.0-rc2? It's not included in 0.6.0-rc1

@tkelman
Copy link
Contributor

tkelman commented May 15, 2017

merged in december, what makes you think it isn't in rc1?

@ranjanan
Copy link
Contributor

My bad, I was using 0.5 instead. Forget I asked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
parser Language parsing and surface syntax
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants