# Bug/unexpected behavior when extending Base.any with new type

**URL:** <https://discourse.julialang.org/t/bug-unexpected-behavior-when-extending-base-any-with-new-type/94359>\
**Category:** General Usage\
**Created:** [February 9, 2023, 4:41pm UTC](https://discourse.julialang.org/t/bug-unexpected-behavior-when-extending-base-any-with-new-type/94359 "2023-02-09T16:41:58Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![mikmoore](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mikmoore/32/31109_2.png) [@mikmoore](https://discourse.julialang.org/u/mikmoore)\
**Post date:** [February 9, 2023, 7:40pm UTC](https://discourse.julialang.org/t/bug-unexpected-behavior-when-extending-base-any-with-new-type/94359/5 "2023-02-09T19:40:26Z")

</div>

Both your original version or the suggestion to implement `Base.any(array::Matrix{<:Real})` are cases of [type piracy](https://docs.julialang.org/en/v1/manual/style-guide/#Avoid-type-piracy) (see [examples](https://discourse.julialang.org/t/minimal-working-example-that-demonstrates-the-danger-of-type-piracy/66922/1)). You have modified a function you do not “own” (is not originally defined in the code you’re working on) for a type that you also do not own.

Piracy risks breaking your entire Julia session (and anyone’s who uses your code) in subtle and insidious ways and is _strongly_ discouraged. I recommend using the suggested call to `any(==(1), A; dims=2)`, which is exactly equal to your version but more flexible and not a case of piracy.

---

_[View the full topic](https://discourse.julialang.org/t/bug-unexpected-behavior-when-extending-base-any-with-new-type/94359)._
