# Why does \`@edit\` fail with keyword argument?

**URL:** https://discourse.julialang.org/t/why-does-edit-fail-with-keyword-argument/16235
**Category:** General Usage
**Tags:** question
**Created:** [October 12, 2018, 2:30pm UTC](https://discourse.julialang.org/t/why-does-edit-fail-with-keyword-argument/16235 "2018-10-12T14:30:42Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![chobbes](https://avatars.discourse-cdn.com/v4/letter/c/848f3c/32.png) [@chobbes](https://discourse.julialang.org/u/chobbes)
#### Post date: [October 12, 2018, 2:30pm UTC](https://discourse.julialang.org/t/why-does-edit-fail-with-keyword-argument/16235/1 "2018-10-12T14:30:42Z")

</div>

With Julia-v1.0:

```julia
julia> @edit isapprox(10, 11; atol = 2)
ERROR: could not determine location of method definition
Stacktrace:
 [1] functionloc at .\reflection.jl:957 [inlined]
 [2] functionloc at .\reflection.jl:967 [inlined]
 [3] edit(::Function, ::Any) at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr
\share\julia\stdlib\v1.0\InteractiveUtils\src\editless.jl:93
 [4] top-level scope at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\j
ulia\stdlib\v1.0\InteractiveUtils\src\macros.jl:15

```

In fact, this has been the case for a while, at least can be traced back to Julia-v0.6.4:

```julia
julia> @edit isapprox(10, 11; atol = 2)
ERROR: could not determine location of method definition

```

Or should I expect `@edit` to be failing in the presence of any keyword arguments?

Retrospectively, both ASTInterpreter and ASTInterpreter2 fail with any keyword argument as well. But that’s another issue…

---

<div class="post-metadata">

### Author: ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)
#### Post date: [October 12, 2018, 2:49pm UTC](https://discourse.julialang.org/t/why-does-edit-fail-with-keyword-argument/16235/2 "2018-10-12T14:49:13Z")

</div>

The keyword argument call is lowered to:

```julia
julia> Core.kwfunc(isapprox)((atol=2,), isapprox, 10, 11)
true

```

so the actual call is to a `kwfunc` function and the macro is not smart enough to figure out how to find the original keyword argument function yet.

---

<div class="post-metadata">

### Author: ![chobbes](https://avatars.discourse-cdn.com/v4/letter/c/848f3c/32.png) [@chobbes](https://discourse.julialang.org/u/chobbes)
#### Post date: [October 12, 2018, 2:59pm UTC](https://discourse.julialang.org/t/why-does-edit-fail-with-keyword-argument/16235/3 "2018-10-12T14:59:11Z")

</div>

> [@kristoffer.carlsson](#):
>
> so the actual call is to a `kwfunc` function and the macro is not smart enough to figure out how to find the original keyword argument function yet.

So it’s a bug but wontfix?

---

<div class="post-metadata">

### Author: ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)
#### Post date: [October 12, 2018, 3:03pm UTC](https://discourse.julialang.org/t/why-does-edit-fail-with-keyword-argument/16235/4 "2018-10-12T15:03:38Z")

</div>

> [@chobbes](#):
>
> So it’s a bug but wontfix?

Not really, more like, making the macro able to handle this would be very nice it just currently doesn’t.

---

<div class="post-metadata">

### Author: ![chobbes](https://avatars.discourse-cdn.com/v4/letter/c/848f3c/32.png) [@chobbes](https://discourse.julialang.org/u/chobbes)
#### Post date: [October 12, 2018, 3:06pm UTC](https://discourse.julialang.org/t/why-does-edit-fail-with-keyword-argument/16235/5 "2018-10-12T15:06:06Z")

</div>

> [@kristoffer.carlsson](#):
>
> Not really, more like, making the macro able to handle this would be very nice it just currently doesn’t.

Thanks! Cool if one day this can be improved. The fail is just a bit glaring.

---

<div class="post-metadata">

### Author: ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)
#### Post date: [October 12, 2018, 3:06pm UTC](https://discourse.julialang.org/t/why-does-edit-fail-with-keyword-argument/16235/6 "2018-10-12T15:06:53Z")

</div>

Ref [`@edit` cannot locate functions with keyword arguments · Issue #20295 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/issues/20295)

---

<div class="post-metadata">

### Author: ![chobbes](https://avatars.discourse-cdn.com/v4/letter/c/848f3c/32.png) [@chobbes](https://discourse.julialang.org/u/chobbes)
#### Post date: [October 12, 2018, 3:08pm UTC](https://discourse.julialang.org/t/why-does-edit-fail-with-keyword-argument/16235/7 "2018-10-12T15:08:12Z")

</div>

> [@fredrikekre](#):
>
> Ref [https://github.com/JuliaLang/julia/issues/20295](https://github.com/JuliaLang/julia/issues/20295)

Thanks for pointing out. Didn’t search thoroughly. Guilty.

Btw, that’s way back in the history. Almost two years.

---

<div class="post-metadata">

### Author: ![kevbonham](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevbonham/32/216165_2.png) [@kevbonham](https://discourse.julialang.org/u/kevbonham)
#### Post date: [October 12, 2018, 10:01pm UTC](https://discourse.julialang.org/t/why-does-edit-fail-with-keyword-argument/16235/8 "2018-10-12T22:01:36Z")

</div>

> [@chobbes](#):
>
> Btw, that’s way back in the history. Almost two years.

The downside of open source is that even things everyone agrees should be fixed, won’t be fixed if no one takes the time to fix it. I for one am thankful for all the people spending time making this language awesome!

(Not implying you meant different 🙂)
