The best feature of Rust is that I’m allowed to name a variable “class”
-
-
-
r#type to the rescue!
4 replies 0 retweets 10 likes -
But this looks bad :( Especially the fact that Rust requires this even for properties instead of doing what ES5 did. Identifiers should be first-class citizens IMO.
1 reply 0 retweets 1 like -
I agree it doesn’t look great, but at least it works. I’m not familiar with ES5’s behavior here
1 reply 0 retweets 0 likes -
ES5 allows arbitrary identifiers after dot / before colon. This requires one token lookahead, but Rust needs it in other places anyway, so shouldn't be an issue.
1 reply 0 retweets 1 like -
Replying to @RReverser @steveklabnik and
So in JS: let class = ...; // not valid because keyword might be special here let obj = { class: ... }; // ok obj.class // also ok
2 replies 0 retweets 2 likes -
Replying to @RReverser @steveklabnik and
i prefer to not have them as it could make things confusing especially for newcomers
1 reply 0 retweets 0 likes -
Replying to @DPC_22 @steveklabnik and
Why? This was battle tested in JS for a while, and I'm not aware of anyone complaining (and people are usually pretty vocal about JS issues).
1 reply 0 retweets 1 like -
Replying to @RReverser @DPC_22 and
I think errors on not being able to put e.g. `type` in your struct are much more confusing.
1 reply 0 retweets 1 like
I agree. Not being able to use `type` as a variable name is extremely annoying. I use `type_` instead because `r#type` is horrible.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.