# 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:** 37

<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:** [August 5, 2023, 9:26pm UTC](https://discourse.julialang.org/t/did-julia-community-do-something-to-improve-its-correctness/102515/37 "2023-08-05T21:26:26Z")

</div>

If you look at the example in the issue, the mutable functor in question is user-defined:

> <https://github.com/JuliaLang/julia/issues/50440>
>
> From docstring of \`reverse\` 
> \> \`reverse(itr)\` is an iterator over the
> same col…lection but in the reverse order.
> 
> yet consider
> \`\`\`
> julia\> mutable struct RollingMax
> m
> end
> 
> julia\> function (rm::RollingMax)(x)
> if x \> rm.m
> rm.m = x
> return true
> else
> return false
> end
> end
> 
> julia\> arr = rand(10);
> 
> julia\> Iterators.filter(RollingMax(0), arr) |\> collect
> 5-element Vector{Float64}:
> 0.20543016348395104
> 0.40777744342276
> 0.6118207748963927
> 0.6765659450947831
> 0.8719846507332757
> 
> julia\> Iterators.filter(RollingMax(0), arr) |\> Iterators.reverse |\> collect
> 2-element Vector{Float64}:
> 0.839252025474182
> 0.8719846507332757
> \`\`\`
> 
> personally I think \`reverse(f::Filter)\` should just be removed; it cannot be implemented correctly without knowing the purity of the predicate. another option is to add a warning in the docs? or maybe a third option is to somehow dispatch \`reverse\` only when \`flt\` can be proven pure---not sure how this is technically possible though.

And passed into `Iterators.filter` and `Iterators.reverse`.

As I’ve mentioned above statements like “seems like a totally unholdable claim” don’t help this conversation… we do actually want to know in what language you can both

1. do that easily  
and
2. it correctly handles the distinction between a pure function and an impure function

Then we have a clear comparison to make, and maybe something to learn from

---

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