What do you dislike about Rust?

The fact that x..y represents [x..y) instead of [x..y].

3 Likes

https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html

Read that, like its really important about how to properly represent ranges.

However, rust does have a way to represent inclusive ranges, x..=y.

2 Likes

It does, it just makes no sense to me to why inclusiveness on one end should be represented differently from inclusiveness on the other. I believe Python does the same thing with ranges, whereas Haskell, Elixir, Erlang do not, so in this regard they are clearly superior as far as the way my brain works is concerned :smiley:

3 Likes

And now let’s take a look at ruby, where 1..10 is inclusive and 1...10 is not, or is it the other way around?

2 Likes

1...10 should be ditched :laughing:

Don’t think I have ever used it…

2 Likes

Because mathematically ranges should always be inclusive…exclusive, else a lot of math becomes just a lot harder. It’s a similar reason as to why we start at 0 instead of 1, mathematically it makes so much more sense and simplifies code and reasoning in the vast vast majority of cases. See the prior link (for note, Dijkstra is a pretty huge name in both math and programming). :slight_smile: