Rust has clever tuple indexing, but square brackets would have been fine. What's wrong with `tuple[0]`? #rustlangpic.twitter.com/E0VY70zxuV
You can add location information to your Tweets, such as your city or precise location, from the web and via third-party applications. You always have the option to delete your Tweet location history. Learn more
So it's to prevent dynamic access at runtime. By using `[]` it could imply `tuple[i]` was acceptable when it isn't. Did I make sense of it correctly?
Yup! Another way to think about it: fn foo(tuple: (i32, String), index: usize ) -> ? { tuple[index] } What would the return type be, at the ?. You can’t know. So it doesn’t work.
This makes sense until Rust gets 'constexpr' like C++. How do you index a tuple with this syntax, using an index returned by a 'constexpr' function?
You can’t. Const fn won’t be in stable this year, so in the pre-1.0 days when this was designed, it wasn’t really a consideration. Sounds like a good place for improvement!
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.