Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Five Years of Rust. Parent comment
The reason > needs braces is that without them, if you're parsing and so far you've seen these characters:
let y: RectangularArray<i32, X, 2>
But if it was square brackets, then a closing square bracket on its own can only ever be the end of the list:
let y: RectangularArray[i32, X, 2]
let y: RectangularArray[i32, X, a[1]
https://keleshev.com/parsing-ambiguity-type-argument-v-less-...
https://soc.me/languages/stop-using-for-generics
The reason > needs braces is that without them, if you're parsing and so far you've seen these characters:
You don't know if that final > is ending the argument list, or is a greater-than operator, with the rest of an expression coming after it.But if it was square brackets, then a closing square bracket on its own can only ever be the end of the list:
Because if it was closing an array access, there would have to have been an opening square bracket: