News for hackers. Stuff that matters.
Re:Julia 1.9.0 lives up to its promise by sundarurfriend on Saturday May 13, 2023 @05:44PM (#35933073)
> With half open ranges, the length of the range is the end minus the beginning, which is nice.

But I already know from real life that if there's maintanence in blocks 5 to 15, that's eleven blocks under maintanence. With half-open ranges, it once again introduces confusion and makes things unintuitive.

We can each find countless examples where each style comes out better, for eg `1:N` most often expresses the intent better than `range(N+1)`. I find people who prefer half-open ranges to be weird and incomprehensible, you probably find my preferences the same, I just don't like the categorical statement often made in this regard that one is inherently and universally superior to the other.

Re:Julia 1.9.0 lives up to its promise by bobbylarrybobby on Saturday May 13, 2023 @06:13PM (#35933288)
Yes, range(n+1) is bad. I hate python as well. You want something like Rust’s m..n and m..=n to have the choice. Anyway, if you have half open ranges, it's trivial to get a closed range (add one to the right endpoint), but going the other direction is not so simple.
Re:Julia 1.9.0 lives up to its promise by Iwan-Zotow on Saturday May 13, 2023 @06:15PM (#35933307)
Julia ranges are not composable, period

In Python, C/C++ and its descendant

[0...N)=[0...N/2)+[N/2...N)