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

remove the :: after type names in "as" expressions #1686

Closed
nikomatsakis opened this issue Jan 27, 2012 · 5 comments
Closed

remove the :: after type names in "as" expressions #1686

nikomatsakis opened this issue Jan 27, 2012 · 5 comments
Assignees
Labels
A-frontend Area: Compiler frontend (errors, parsing and HIR) E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@nikomatsakis
Copy link
Contributor

Currently, you must write foo as bar::<X> if the type you are casting to contains a type parameter. I find this very unintuitive. I think the rule "type names do not require ::, explicit function type parameters do" is easy enough to explain. But the rule ":: are needed in expressions, but only where it might cause ambiguity" is a bit more troublesome.

I realize there is a kind of ambiguity (foo as uint < 5) but I am ok with having to write (foo as uint) < 5 in this case. I think this will come up less often than casting to parameterized interfaces.

@graydon
Copy link
Contributor

graydon commented Feb 15, 2012

I don't particularly care, and doubt it's a big enough issue to warrant the RFC tag. Suspect if you just poke at the parser and change this nobody is likely to complain. You are already clearly in a type-expression context so it's just a matter of bumping precedence (unlike foo<int>( ... ) where we'd have to get resolver feedback mid-parse to realize we'd switched to type-expression grammar).

@ghost ghost assigned nikomatsakis Apr 12, 2012
@sanxiyn
Copy link
Member

sanxiyn commented Mar 29, 2013

@pcwalton, I think this was done?

@graydon
Copy link
Contributor

graydon commented Apr 19, 2013

see also #1429 and #1187

@nikomatsakis
Copy link
Contributor Author

I think this was fixed by @pcwalton

@pcwalton
Copy link
Contributor

Closing; I'm pretty sure I fixed this.

celinval pushed a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-frontend Area: Compiler frontend (errors, parsing and HIR) E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

No branches or pull requests

4 participants