# Did Julia community do something to improve its correctness?

**URL:** <https://discourse.julialang.org/t/did-julia-community-do-something-to-improve-its-correctness/102515>\
**Category:** General Usage\
**Created:** [August 5, 2023, 7:16am UTC](https://discourse.julialang.org/t/did-julia-community-do-something-to-improve-its-correctness/102515 "2023-08-05T07:16:42Z")\
**Posts on this page:** 20\
**Page:** 6

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [October 23, 2023, 7:34pm UTC](https://discourse.julialang.org/t/did-julia-community-do-something-to-improve-its-correctness/102515/146 "2023-10-23T19:34:35Z")

</div>

Yeah, my only point was that I think that the relevance of such list of issues for everyday programming is overrated.

And, for the records:

```python
In [1]: import numpy as np

In [2]: a = np.random.random(10_000_000)

In [3]: np.sum(a.reshape((-1, 1)), axis=1, out=a)
Out[3]: 
array([0.83372408, 0.09255398, 0.34395135, ..., 0.51044679, 0.64471536,
       0.46825184])

In [4]: %timeit np.sum(a.reshape((-1, 1)), axis=1, out=a)
37.6 ms ± 522 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)

```

```julia-repl
julia> @btime sum!(a,a;init=false) setup=(a=rand(10_000_000)) evals=1;
  7.344 ms (0 allocations: 0 bytes)

```

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [October 23, 2023, 7:42pm UTC](https://discourse.julialang.org/t/did-julia-community-do-something-to-improve-its-correctness/102515/147 "2023-10-23T19:42:41Z")

</div>

> [@ToucheSir](#):
>
> But notably, neither the `init` keyword or what it does in `sum!` are to be found anywhere in that same docstring. I don’t think I’m alone in only learning of its existence in mutating `sum!`/`prod!` today.

It is not clear to me that `init` was ever meant to be part of the public API. That said, I think documenting it might help people understand what it does.

My guess is that `init` was added to solve head off another correct issue early on.

```julia
julia> A = Vector{Int}(undef, 3)
3-element Vector{Int64}:
 140320323899536
 140320345387120
               0

julia> sum!(A, [1 2; 3 4; 5 6]; init=false)
3-element Vector{Int64}:
 140320323899539
 140320345387127
              11

julia> A = Vector{Int}(undef, 3)
3-element Vector{Int64}:
 5929362882510025827
 3544382716706496582
      45226851069486

julia> sum!(A, [1 2; 3 4; 5 6])
3-element Vector{Int64}:
  3
  7
 11

```

---

<div class="post-metadata">

**Author:** ![ToucheSir](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/touchesir/32/14411_2.png) [@ToucheSir](https://discourse.julialang.org/u/ToucheSir)\
**Post date:** [October 23, 2023, 8:25pm UTC](https://discourse.julialang.org/t/did-julia-community-do-something-to-improve-its-correctness/102515/148 "2023-10-23T20:25:17Z")

</div>

The thread split messed things up, but I was responding to a comment which suggested Numpy wasn’t working as expected but using not using an equivalent bit of code for comparison (i.e. not using the in-place `sum` function).

But yes, I agree comparisons are only useful insofar as they can correct mistaken assumptions such as “there’s no way to do this safely”. Thankfully `sum!` at least provides a warning in its docstring, so thus I don’t think it’s the best representative for the broader topic on hand.

To the broader topic, I think what @mschauer touches on about bugs which can show up using _only_ functionality from stdlibs (no “distributed SVD of a BlockedArray filled with Unitful Quaternions”) and the difficulties in getting them fixed is worth exploring. Using [Did Julia community do something to improve its correctness? - #121 by mschauer](https://discourse.julialang.org/t/did-julia-community-do-something-to-improve-its-correctness/102515/121) as an example, one can see a number of barriers:

- Designing proposed fixes often requires a back-and-forth from subject matter experts and/or those with the commit bit, but can often be left hanging if someone gets busy or moves on without a good way to revive them.
- Even when a PR is made, the same can still happen.
- There is a nominally a process, but it’s not consistently applied. Call to action labels like “merge me” or “forget me not” can stick around for months/years. A PR like [`reverse(zip(its...))` now checks lengths of constituent iterators for equality by adienes · Pull Request #50435 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/pull/50435) can have approval, green CI and (based on Slack chat) have gone through triage, but still have labels like “triage” attached and be unmerged.

There has been plenty of ink spilled on how to solve this, but just to list a couple ideas which resonated with me:

- Defining a clear and consistent process for how bug, robustness and maybe docs fixes are triaged and reviewed. e.g. all bugfixes are put into a priority queue based on severity and age, and a certain amount of each triage meeting is set out to go over them.
- Defining and adhering to a guideline for when PRs are complete so they can be landed. Whether that’s some combination of approval, green CI, the merge me label, etc, there should be some way to start this process and some sense of urgency to merge once a PR meets the criteria. I’m sure certain parts of Julialang/Julia will want to be excluded from this (the compiler comes to mind), but enabling it for stdlib bugfixes shouldn’t be that disruptive.

But ultimately, how something like this gets done is less important than declaring it will be done and seeing actions being taken towards that end. My impression from the previous discussion threads on robustness is that a number of ideas are thrown around but only the most incremental (if any) changes are implemented. Given that, it’s kind of hard to blame people for bringing the topic up again and again, since what can I or anyone else point at to say “look, it’s being worked on”?

---

<div class="post-metadata">

**Author:** ![dlakelan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dlakelan/32/8491_2.png) [@dlakelan](https://discourse.julialang.org/u/dlakelan)\
**Post date:** [October 23, 2023, 8:45pm UTC](https://discourse.julialang.org/t/did-julia-community-do-something-to-improve-its-correctness/102515/149 "2023-10-23T20:45:54Z")

</div>

I’m imagining a repo that does a lot of correctness tests independent from the implementations. Things like stats fitting, sampling from distributions, summing things matrix arithmetic, etc etc. Perhaps implementing some tests from NIST suites and such. Then it generates a report, clarifying what common mathematical operations work correctly and what ones don’t.

This test suite could be iterated on much quicker than the fixes, and could be used in the bug fixing process to help approve code.

One methodology might be to calculate various things in both Julia and R and compare them for example.

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [October 24, 2023, 12:06am UTC](https://discourse.julialang.org/t/did-julia-community-do-something-to-improve-its-correctness/102515/150 "2023-10-24T00:06:11Z")

</div>

> [@stucash](#):
>
> [this](https://github.com/JuliaLang/julia/issues/39385#issuecomment-1668400231) is actually one issue raised by Yuri and it is one that’s not edgy. It was planned for 1.10 but removed because team has higher priorities (which is fair); but I probably wouldn’t call this issue “random stuff”.

You are misunderstanding thr purpose of the tag. It does not indicate planning or priority. It indicates what would break the release.

The only way to really advance the issue is work on the solution. I think this likely the closest for some resolution: [https://github.com/JuliaLang/julia/pull/50824](https://github.com/JuliaLang/julia/pull/50824)

---

<div class="post-metadata">

**Author:** ![ParadaCarleton](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/paradacarleton/32/20005_2.png) [@ParadaCarleton](https://discourse.julialang.org/u/ParadaCarleton)\
**Post date:** [October 24, 2023, 8:09pm UTC](https://discourse.julialang.org/t/did-julia-community-do-something-to-improve-its-correctness/102515/151 "2023-10-24T20:09:11Z")

</div>

> [@ChrisRackauckas](#):
>
> Which packages? Some high schooler’s homework project or DataFrames?

I appreciate your point that not all packages have the same level of correctness, but I don’t think it’s fair to imply that bugs only occur in obscure or unused packages. For example, the JuliaStats ecosystem, which is widely used and respected, has many correctness issues that affect me and other users. I often encounter problems with `@inbounds`, type conversions, and out-of-bounds in packages like Distributions.jl and StatsBase.jl. These issues often keep me from using Julia for serious statistical computing, even though I love Turing.jl and many other parts of the Julia ecosystem.

These problems aren’t always related to Julia offering a greater degree of composability either. I often find it easier to compose packages in Python and R than I do in Julia, because they have more standardized and documented interfaces for different tasks. For instance, if I want to use labelled arrays, autodiff, differential equations, or tensor algebra in Python, I know there is a widely adopted package for each one of these purposes (XArray, JAX, Equinox, and PyTensor), all of which have been tested for compatibility with PyMC. [In Julia, there are many different implementations of these functionalities, which makes it hard to ensure compatibility and correctness.](http://www.winestockwebdesign.com/Essays/Lisp_Curse.html)

This is all even before we start talking about the autodiff ecosystem, which is often a major barrier to making any serious progress in Julia. I appreciate the progress that Enzyme has made here over the past year, but I still have some concerns about whether its current problems are just growing pains, or if they just reflect the difficulty of trying to write autodiff in assembly. After being burned by several autodiff systems with major correctness bugs, there’s a real feeling in the community that we can’t fully trust anything until we’ve tested it in our own code.

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [October 24, 2023, 8:11pm UTC](https://discourse.julialang.org/t/did-julia-community-do-something-to-improve-its-correctness/102515/152 "2023-10-24T20:11:40Z")

</div>

Well, don’t take it the wrong way, but what exactly are you expecting to gain here when all your needs are met by Python and R?

---

<div class="post-metadata">

**Author:** ![ParadaCarleton](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/paradacarleton/32/20005_2.png) [@ParadaCarleton](https://discourse.julialang.org/u/ParadaCarleton)\
**Post date:** [October 24, 2023, 8:12pm UTC](https://discourse.julialang.org/t/did-julia-community-do-something-to-improve-its-correctness/102515/153 "2023-10-24T20:12:24Z")

</div>

Syntactic macros, performance, cleaner mathematical syntax, better abstractions (Distributions.jl has an amazing high-level design, despite all of its correctness issues), functional/procedural programming instead of OOP, not having to learn/work in C++…

There’s lots of great things about Julia! But unfortunately, a well-tested and thoroughly-debugged ecosystem isn’t one of them.

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [October 24, 2023, 8:39pm UTC](https://discourse.julialang.org/t/did-julia-community-do-something-to-improve-its-correctness/102515/154 "2023-10-24T20:39:43Z")

</div>

> [@ParadaCarleton](#):
>
> But unfortunately, a well-tested and thoroughly-debugged ecosystem isn’t one of them.

This is an unhelpful overgeneralization, IMO. In my six years with Julia I think I reported a couple of minor bugs in the standard library, and about the same number elsewhere…

---

<div class="post-metadata">

**Author:** ![simsurace](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simsurace/32/30216_2.png) [@simsurace](https://discourse.julialang.org/u/simsurace)\
**Post date:** [October 24, 2023, 8:51pm UTC](https://discourse.julialang.org/t/did-julia-community-do-something-to-improve-its-correctness/102515/155 "2023-10-24T20:51:24Z")

</div>

> [@ParadaCarleton](#):
>
> I often encounter problems with `@inbounds`, type conversions, and out-of-bounds in packages like Distributions.jl and StatsBase.jl.

Do those have open issues we can track?

---

<div class="post-metadata">

**Author:** ![ParadaCarleton](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/paradacarleton/32/20005_2.png) [@ParadaCarleton](https://discourse.julialang.org/u/ParadaCarleton)\
**Post date:** [October 24, 2023, 8:53pm UTC](https://discourse.julialang.org/t/did-julia-community-do-something-to-improve-its-correctness/102515/156 "2023-10-24T20:53:51Z")

</div>

> [@PetrKryslUCSD](#):
>
> This is an unhelpful overgeneralization, IMO. In my six years with Julia I think I reported a couple of minor bugs in the standard library, and about the same number elsewhere…

I personally am talking about the ecosystem (packages outside the stdlib), not the standard library (which I’d agree with you on).

---

<div class="post-metadata">

**Author:** ![ParadaCarleton](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/paradacarleton/32/20005_2.png) [@ParadaCarleton](https://discourse.julialang.org/u/ParadaCarleton)\
**Post date:** [October 24, 2023, 8:54pm UTC](https://discourse.julialang.org/t/did-julia-community-do-something-to-improve-its-correctness/102515/157 "2023-10-24T20:54:42Z")

</div>

> [@simsurace](#):
>
> Do those have open issues we can track?

Yep, and have since Yuri opened them a few years ago.

---

<div class="post-metadata">

**Author:** ![Raf](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raf/32/3383_2.png) [@Raf](https://discourse.julialang.org/u/Raf)\
**Post date:** [October 24, 2023, 8:57pm UTC](https://discourse.julialang.org/t/did-julia-community-do-something-to-improve-its-correctness/102515/158 "2023-10-24T20:57:09Z")

</div>

@ParadaCarleton you know the drill here, complaints need links

(you must have a doc with thes listed somewhere by now 😂)

---

<div class="post-metadata">

**Author:** ![simsurace](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simsurace/32/30216_2.png) [@simsurace](https://discourse.julialang.org/u/simsurace)\
**Post date:** [October 24, 2023, 9:11pm UTC](https://discourse.julialang.org/t/did-julia-community-do-something-to-improve-its-correctness/102515/159 "2023-10-24T21:11:30Z")

</div>

Do you mean those tagged as bugs, the youngest of which is 4y old?

---

<div class="post-metadata">

**Author:** ![adienes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/adienes/32/37459_2.png) [@adienes](https://discourse.julialang.org/u/adienes)\
**Post date:** [October 24, 2023, 9:17pm UTC](https://discourse.julialang.org/t/did-julia-community-do-something-to-improve-its-correctness/102515/160 "2023-10-24T21:17:34Z")

</div>

e.g. the very recent

> <https://github.com/JuliaArrays/StaticArrays.jl/pull/1200>
>
> Issue reported on Slack.

---

<div class="post-metadata">

**Author:** ![simsurace](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simsurace/32/30216_2.png) [@simsurace](https://discourse.julialang.org/u/simsurace)\
**Post date:** [October 24, 2023, 9:34pm UTC](https://discourse.julialang.org/t/did-julia-community-do-something-to-improve-its-correctness/102515/161 "2023-10-24T21:34:33Z")

</div>

That‘s certainly a good example of an issue around @inbounds, but I was asking about the specific ones in Distributions.jl or StatsBase.jl.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [October 24, 2023, 10:22pm UTC](https://discourse.julialang.org/t/did-julia-community-do-something-to-improve-its-correctness/102515/162 "2023-10-24T22:22:47Z")

</div>

> [@ParadaCarleton](#):
>
> but I don’t think it’s fair to imply that bugs only occur in obscure or unused packages. For example, the JuliaStats ecosystem, which is widely used and respected, has many correctness issues that affect me and other users. I often encounter problems with `@inbounds`, type conversions, and out-of-bounds in packages like Distributions.jl and StatsBase.jl.

Please at least try a fair read of my comments. I obviously am not implying bugs only occur in obscure or unused packages. I remain one of the biggest critics of JuliaStats for a multitude of reasons. My point is precisely that I know JuliaStats has these issues, but that doesn’t mean other ecosystems have these issues. People who are pointing to this correctness problem keep pointing to examples in JuliaStats. Yes, I agree JuliaStats has many issues, but “Julia” is not just “JuliaStats”. Equating the two is a huge huge huge generalization of the Julia community. So it’s funny that the example that you point out is exactly this same example.

---

<div class="post-metadata">

**Author:** ![Sukera](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Sukera](https://discourse.julialang.org/u/Sukera)\
**Post date:** [October 25, 2023, 12:24am UTC](https://discourse.julialang.org/t/did-julia-community-do-something-to-improve-its-correctness/102515/163 "2023-10-25T00:24:24Z")

</div>

> [@ChrisRackauckas](#):
>
> People who are pointing to this correctness problem keep pointing to examples in JuliaStats. Yes, I agree JuliaStats has many issues, but “Julia” is not just “JuliaStats”. Equating the two is a huge huge huge generalization of the Julia community. So it’s funny that the example that you point out is exactly this same example.

The larger point of “has the community overall done something to address this (in a systemic manner)?” stands though - it’s cool if SciML or other subcommunities fix this “on their turf”, but there still isn’t any larger drive to prevent this systemically from occurring in the first place.

It’s always super frustrating to see these calls for “has the ecosystem at large addressed this?” be met with “well MY part of the ecosystem doesn’t have these problems!” - that’s not what was asked 🤷

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [October 25, 2023, 12:40am UTC](https://discourse.julialang.org/t/did-julia-community-do-something-to-improve-its-correctness/102515/164 "2023-10-25T00:40:15Z")

</div>

> [@Sukera](#):
>
> The larger point of “has the community overall done something to address this (in a systemic manner)?” stands though - it’s cool if SciML or other subcommunities fix this “on their turf”, but there still isn’t any larger drive to prevent this systemically from occurring in the first place.

There are plans for interfaces that are being tested. A lot of ecosystems are locking down the interfaces more and more.

---

<div class="post-metadata">

**Author:** ![ParadaCarleton](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/paradacarleton/32/20005_2.png) [@ParadaCarleton](https://discourse.julialang.org/u/ParadaCarleton)\
**Post date:** [October 25, 2023, 3:07am UTC](https://discourse.julialang.org/t/did-julia-community-do-something-to-improve-its-correctness/102515/165 "2023-10-25T03:07:01Z")

</div>

> [@ChrisRackauckas](#):
>
> Please at least try a fair read of my comments.

I mean, I did.

> [@ChrisRackauckas](#):
>
> People who are pointing to this correctness problem keep pointing to examples in JuliaStats. Yes, I agree JuliaStats has many issues, but “Julia” is not just “JuliaStats”.

It’s not just JuliaStats. Zygote is infamous for this. If what you _really_ want is an example from SciML, QMC.jl was riddled with correctness issues before I essentially rewrote it from scratch last year.

[Previous page](https://discourse.julialang.org/t/did-julia-community-do-something-to-improve-its-correctness/102515.md?page=5)

[Next page](https://discourse.julialang.org/t/did-julia-community-do-something-to-improve-its-correctness/102515.md?page=7)
