chobbes
October 12, 2018, 2:30pm
#1
With Julia-v1.0:
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> @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…
The keyword argument call is lowered to:
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.
chobbes
October 12, 2018, 2:59pm
#3
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.
2 Likes
chobbes
October 12, 2018, 3:06pm
#5
Thanks! Cool if one day this can be improved. The fail is just a bit glaring.
chobbes
October 12, 2018, 3:08pm
#7
Thanks for pointing out. Didn’t search thoroughly. Guilty.
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 )
1 Like