3 ms·
> Nim almost gets there: (x .. y) is end-inclusive, and (x ..< y) is end-exclusive - but the syntax still exhibits a preference. Swift is similar, using `...`
by pansa2 6y ago
> Nim almost gets there: (x .. y) is end-inclusive, and (x ..< y) is end-exclusive - but the syntax still exhibits a preference.
Swift is similar, using `...` and `..<`. Rust uses an alternative convention, `..=` and `..`.
Would you prefer to see `..=` and `..<` so that inclusivity/exclusivity is always explicit?
- int_19h 6y agoYep, pretty much. I'm a strong proponent of "explicit is better than implicit" in all cases where there's no default that's obviously preferable, and this is is one of those cases - that different languages picked different defaults is all the evidence I need.