A.
If I do:
julia> @which select(:chosen_index; options=:drop_down)
(::Genie.Renderer.Html.var"#select##kw")(::Any, ::typeof(select), children, args...) in Genie.Renderer.Html at none:1
Long story short, I actually found it here (after looking through Genie.jl, then guessing Stipple* after this misdirection; why didn’t I find this right away? for the general case, see below):
it’s not too helpful… Usually @edit
and @less
have been great to know about, and I suppose use the same info @which
provides, or I guess @functionloc
that I just found out about.
I guess while these usually work, and I find nothing more in the manual, it’s not possible?
This is unlike for:
julia> @functionloc 1+1
("/home/pharaldsson_sym/julia-1.6.0-rc1/share/julia/base/int.jl", 87)
a bit better to know about than only:
julia> @which 1+1
+(x::T, y::T) where T<:Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8} in Base at int.jl:87
I think the reason for this “at none:1” business (in general, not this case though), when I do not get a file and a real line number, is that the function I’m calling was made by a macro (always? what are to possibilities, look for eval?).
Why do I not find that macro or is there a way? Since the macro made the function and it’s kept in memory somewhere, can it be found in human-readable form, or only assembly/LLVM available? Even that might be better than nothing sometimes…
To answer my own question there’s (and the corresponding @code_llvm
and and @code_native
are not to helpful too verbose in this case):
julia> @code_lowered select(options=:drop_down)
CodeInfo(
1 ─ %1 = (#s50)(@_2, @_3, "")
└── return %1
)
possibly most helpful:
julia> @code_typed select(:chosen_index; options=:drop_down)
CodeInfo(
1 ─ %1 = %new(Base.Iterators.Pairs{Symbol, Symbol, Tuple{Symbol}, NamedTuple{(:options,), Tuple{Symbol}}}, @_2, (:options,))::Base.Iterators.Pairs{Symbol, Symbol, Tuple{Symbol}, NamedTuple{(:options,), Tuple{Symbol}}}
│ %2 = invoke Genie.Renderer.Html.:(var"#select#405")(%1::Base.Iterators.Pairs{Symbol, Symbol, Tuple{Symbol}, NamedTuple{(:options,), Tuple{Symbol}}}, Genie.Renderer.Html.select::typeof(select), _4::Symbol)::String
└── return %2
) => String
B.
What people may want (some seem to think OO means this), is to find possible methods from a type, in IDE for single-dispatch OO: mytype.<TAB>
some drop-down box showing.
Can you do similar for multiple-dispatch: (mytype,
pressing TAB giving a list of methods would be awesome, or possibly with a longer list of types constraining the list: (mytype1, mytype2,
TAB. Is at least something similar possible in the REPL if not VSCode already?
C.
Hovering over select in VSCode I got 8 definitions (I suppose a complete list, not something I noticed immediately), but right-clicking then “Go to Definition” gave me only 3, those from Genie.jl in the same file, and missing out on the one from StippleUI from above, and 4 others.