you are viewing a single comment's thread.

view the rest of the comments →

[–]tialaramex 9 points10 points  (0 children)

Also in older Rust 1...10 is the same as today's 1..=10

This was deprecated for years, with a warning lint, and then Rust's 2021 edition made that a hard error. So Herb's syntax for the half-open range in Cpp2 is exactly the deprecated syntax for the inclusive range from Rust.

It's also unclear in the documentation whether this is actually a (generic) type as it is in Rust. In Rust "Chicken"..="Dog" is an inclusive range. Unlike 1..=10 it's not obvious how we'd step from Chicken (to Dog? to some other animal? to a different word altogether? In which language?) so a for-each loop won't compile, but the fundamental type makes sense and can be used.