显示来自 repl 的函数源代码

Phu*_*uoc 5 julia

我想查看 REPL 中方法的定义。我点击此链接(https://github.com/JuliaLang/julia/issues/2625),但它不起作用:

julia> f(x) = x^2
f (generic function with 1 method)

julia> expand(f)
f (generic function with 1 method)

julia> methods(f)
# 1 method for generic function "f":
f(x) at REPL[155]:1

julia> implementation(f,1)
ERROR: UndefVarError: implementation not defined
 in eval_user_input(::Any, ::Base.REPL.REPLBackend) at ./REPL.jl:64
 in macro expansion at ./REPL.jl:95 [inlined]
 in (::Base.REPL.##3#4{Base.REPL.REPLBackend})() at ./event.jl:68
Run Code Online (Sandbox Code Playgroud)

好像这个方法implementation不存在。

mig*_*raz 3

我相信直接的方法还没有实现。

这是一位创作者在 6 个月前这么说的 - 似乎没有制作,因为有一些重复的问题。

/sf/answers/2636409121/