Skip to content

Decide what precedence .. should have #20256

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

Closed
ftxqxd opened this issue Dec 27, 2014 · 7 comments
Closed

Decide what precedence .. should have #20256

ftxqxd opened this issue Dec 27, 2014 · 7 comments
Assignees

Comments

@ftxqxd
Copy link
Contributor

ftxqxd commented Dec 27, 2014

Currently, 1i + 1i..1i + 1i is parsed as 1i + (1i..(1i + 1i)). This seems problematic. I would expect it to be parsed as (1i + 1i)..(1i + 1i) (to match with how the current slicing syntax behaves), or possibly as 1i + (1i..1i) + 1i.

@nagisa
Copy link
Member

nagisa commented Dec 27, 2014

I think cc @nick29581

@nrc
Copy link
Member

nrc commented Jan 7, 2015

I agree they should be parsed as (1i + 1i)..(1i + 1i)

@nrc
Copy link
Member

nrc commented Jan 7, 2015

I think 1..2..3 should be an error rather than resolving either way, since there is not an obvious right answer

@sinistersnare
Copy link
Contributor

@nick29581 could 1..2..3 work if there was a Range<Range<int,int>, int> implementation? (random question)

@nrc
Copy link
Member

nrc commented Jan 7, 2015

@sinistersnare We could make it work in one direction or the other, but I'm not sure I'd want to - (1..2)..3 is not too much hassle and it's a lot clearer

@sinistersnare
Copy link
Contributor

Sure, makes sense :)

@nrc nrc self-assigned this Jan 7, 2015
@nrc nrc closed this as completed in 63a9bd5 Jan 8, 2015
@dgrunwald
Copy link
Contributor

So did we decide on a specific precedence level? I'd argue it should be lower than arithmetic operators (which is now fixed); but higher than comparison operators (range == 1..2 should be valid, but currently isn't).

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

6 participants