# Unexpected extension of methods

**URL:** <https://discourse.julialang.org/t/unexpected-extension-of-methods/63312>\
**Category:** New to Julia\
**Tags:** function, functions\
**Created:** [June 21, 2021, 4:25pm UTC](https://discourse.julialang.org/t/unexpected-extension-of-methods/63312 "2021-06-21T16:25:04Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [June 21, 2021, 6:50pm UTC](https://discourse.julialang.org/t/unexpected-extension-of-methods/63312/2 "2021-06-21T18:50:31Z")

</div>

This is yet another case of [Confused by behaviour of nested functions](https://discourse.julialang.org/t/confused-by-behaviour-of-nested-functions/20576) , which is definitely an unfortunate gotcha of the language. As discussed in that thread, it’s usually better to conditionally return a different anonymous function rather than conditionally adding or redefining methods like that.

---

_[View the full topic](https://discourse.julialang.org/t/unexpected-extension-of-methods/63312)._
