# 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:** 1\
**Showing post:** 86

<div class="post-metadata">

**Author:** ![jlapeyre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jlapeyre/32/4514_2.png) [@jlapeyre](https://discourse.julialang.org/u/jlapeyre)\
**Post date:** [August 7, 2023, 12:01am UTC](https://discourse.julialang.org/t/did-julia-community-do-something-to-improve-its-correctness/102515/86 "2023-08-07T00:01:45Z")

</div>

At first wasn’t very concerned about this example. It’s typical of examples meant to illustrate the rampant incorrectness.

In general the function is called like `map!(c, a, b)`. In the examples in the doc string, the input and output are clearly not aliased. In fact `c` is freshly initialized. Many numerical libraries work like this. It is very common to read something like “output must not be aliased to input”. So if I see the doc to `map!(c, a, b)` and thought, “well it didnt say I cant alias, I guess I just do it and move on”, I’m asking for trouble. If I didn’t read the doc string, I’d never assume it. I’d check it first or ask or something.

If this were the end of the story, I’d say it’s not such a big deal.

The bigger problem, apparently, is that

1. behavior with aliasing is not documented.
2. behavior with aliasing was not properly tested.
3. behavior with aliasing _changed_ in a (non-breaking) release.

Now there’s nothing I can do to avoid a bug in my code, even if I’m careful.

It’s possible that documenting it more carefully may have avoided this. It would have made it less likely that adequate tests were overlooked, and that a breaking change would be introduced.

Note that although the previous behavior has been restored, it’s still not documented.

More generally: I won’t put much stock in the idea that Julia is really buggy based on anecdotes. I’d have to see some attempt at an analysis. And discussion of which languages you’re comparing to.

EDIT:

> <https://github.com/JuliaLang/julia/issues/50814>
>
> \`map!\` should either support aliasing or not and the choice should be documented… and tested. (It could be documented that it's undefined, but probably a bad idea)
> 
> It may be better tested after the PR below merged, but the doc string should be updated.
> 
> Maybe auditing a bit for other similar functions that lack this kind of documentation would be a good idea. I'll add them here if I find them.
> 
> See
> \* #46352
> \* #50780 
> 
> https://discourse.julialang.org/t/did-julia-community-do-something-to-improve-its-correctness/102515/86

---

_[View the full topic](https://discourse.julialang.org/t/did-julia-community-do-something-to-improve-its-correctness/102515)._
