-
Notifications
You must be signed in to change notification settings - Fork 1.7k
foo::<T> -> foo@<T>
#571
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
foo::<T> -> foo@<T>
#571
Conversation
|
I've heard that we can't just have |
|
Not quite sure what I think of the |
|
Is it not simply too late to make this change? (I'm happy with ::, though would be happier with not needing anything) |
|
-1, too late and inconsistent - as much as I dislike |
|
Too late, yes, but I don't think the second half makes sense - it's not a path, and so shouldn't use path syntax. That's the entire point. |
|
Another drawback: this would probably prevent the addition of a FWIW, I prefer the current syntax anyway—I heavily dislike the |
|
Oh, there's that dreadful UFCS syntax. I forgot about that. Reflecting the type-level |
|
What nrc said, I think. I'd be happy if we could have removed the |
|
Strong +1. The As far as breaking changes go, this one doesn't look like it should be much of a problem. It only requires an easy find+replace. Rust is still in alpha anyway so people are expecting the occasional breaking change. |
|
In this reddit thread, I thought of Today I came up with another version of this proposal, // for comparison - past, current, and 3 proposals:
"42".parse.<int>()
"42".parse::<int>()
"42".parse@<int>()
"42".parse!<int>()
"42".parse-<int>()While the lines aren't actually touching, Hasklig can make it so, which I expect to be quite pleasing to the eye, in the end (we should fork it to remove the On the other hand: @nikomatsakis has been mentioning type ascription syntax quite a lot lately, and I do like that prospect. Everyone I've seen using such syntax (in a hypothetical/pseudocode context) goes for // The contrived setup:
struct Foo<T>;
impl<T> Foo<T> {
fn Baz() -> Foo<T> {Foo} // could also be an associated constant
}
struct Bar;
impl Bar {
type Baz = Foo<Bar>;
}
// The following two expressions are both valid but different:
Foo::<Bar>::Baz // type fn() -> Foo<Bar>
Foo:<Bar>::Baz // type Foo<Bar>Whether or not this will be an actual issue, I can't tell, but it seems like a good argument in favor of changing |
|
If people really want to change it, I can see that and if we find something nice looking, I could be for it. Here is a few ways this could be written with keys on my keyboard 👅:
|
It's confusing even after using it for some time. I'd say a good percentage of the compile errors I get are because I messed this up and they sometimes take awhile to figure out too… |
|
-1. There's nothing wrong with |
|
@NervL see my description above of an UFCS/TA complication. But I do agree |
|
I think |
|
A note about the RFC: I believe the syntax as the RFC currently proposes it is ambiguous with UFCS in contrived cases. This is because One case where UFCS in patterns might be usable (but not necessarily useful), although it’s probably not worth supporting: trait Foo {
type T;
}
enum Bar { Baz, Qux }
impl Foo for () {
type T = Bar;
}
fn main() {
match get_a_bar() {
// Because `<() as Foo>` is a definite, non-generic type, it might be
// usable as an alias for `Bar`
<() as Foo>::Baz => ...,
<() as Foo>::Qux => ...,
}
} |
|
@P1start I did have a nagging feeling about it but it took me too long to notice. Not even my (somewhat beautiful) |
|
What about using It looks a bit weird but it's much more consistent. |
@P1start dang, I kind of liked ^, it does work well for hints in Clojure like @sinistersnare states (I thought I remembered you from #clojure) I do not like the @ so much, if it does get changed it should be something terrific to warrant it. I suppose |
|
At this point, I would get rid of / change the comparison operators to free up Also, regarding UCFS, I know we have magic self and are not doing things the haskell way, but even so I still think In sum:
|
|
Thank you very much for the work you put into this RFC. However, at the triage meeting today we decided to close this issue. While the |
Click