julia
julia copied to clipboard
Recommend a workflow for methodswith in the REPL
I've often seen first timers coming from OOP language and then they complain about having to break their workflows and ask questions or google just to know a simple function to use, where in the classical OOP-style, all they needed was an IDE and a dot syntax to list all available methods.
My point is, anything that can help with stuffs like this should be documented in a simple way. My first time using Julia, I certainly didn't wanted the methodswith function, because it broke the whole REPL and won't even show the first 100 functions if the methods is more than 700.
Until recently I started using the workflow I recommended in this patch. So it will be nice if something of that nature is done and then point users to it to keep their workflow stable, ALL IN THE REPL.
This seems like a strange place to put basic information on how to store objects to variables or how to index arrays etc.
But also see https://github.com/JuliaLang/julia/pull/38791.
julia> ?("foo", "bar")<TAB>
*(s1::Union{AbstractChar, AbstractString}, ss::Union{AbstractChar, AbstractString}...) in Base at strings/basic.jl:260
(::Colon)(start::T, stop::T) where T in Base at range.jl:7
==(a::String, b::String) in Base at strings/string.jl:122
CanonicalIndexError(func::String, type) in Base at abstractarray.jl:1255
Regex(pattern::AbstractString, flags::AbstractString) in Base at regex.jl:55
abspath(a::AbstractString, b::AbstractString...) in Base.Filesystem at path.jl:439
asyncmap(f, s::AbstractString; kwargs...) in Base at asyncmap.jl:247
broadcast(f::Tf, As...) where Tf in Base.Broadcast at broadcast.jl:798
broadcast!(f::Tf, dest, As::Vararg{Any, N}) where {Tf, N} in Base.Broadcast at broadcast.jl:837
chopprefix(s::Union{SubString{String}, String}, prefix::Union{SubString{String}, String}) in Base at strings/util.jl:240
chopsuffix(s::Union{SubString{String}, String}, suffix::Union{SubString{String}, String}) in Base at strings/util.jl:282
...
This ? works perfectly as it was designed for, but its a PAIN using it, especially when the methods are very MANY. Its not visual to the eyes.
This PR is recommending a workflow and yeah it might not be the best place to put it, but sure its a workflow.
Where do you think it should be anyways?
Perhaps this could be a section in doc/src/manual/arrays.md about how to view large arrays in the REPL. I've seen that request come up before.
Don't know where exactly it should be in doc/src/manual/arrays.md or under what section. Maybe you should open a PR in there and then link this PR.
I would note that for Emacs users (maybe Vim? though I know little about Vim), having the REPL dump all on methods/methodswith is excellent, as one can simply use things like swiper to fuzzy-search and find what one is looking for with a few keys.
Note that I am not trying to dismiss this PR outright, but I believe that suggesting a burdensome approach in the manual or docstrings should be avoided.
There are many good ways to view large vectors (e.g. using a text editor or ide as @andrewjradcliffe mentioned). The recommendations in this PR are workable, but I do not think they are worth recommending for all users of methods.