Workflow for Contributing to Base

Hi! I’m trying to contribute to Base by making sort(x) print "Hello World" before returning the correct answer. Is there a good workflow without building Julia locally?
(edited for concision)

You can use Revise.jl for Julia base with Revise.track(Base). See What Revise can track.

1 Like

Thanks! Here’s what I’ve ended up doing:

  1. Open a Julia REPL
  2. using Revise (or add to .julia/config/startup.jl)
  3. Revise.track(Base)
  4. @edit sort([3,2,1]) to see that source file is running (/Applications/
  5. edit that source directory in a text editor to instert println("hello world")
  6. run sort([3,2,1]) in the original REPL

A manual way to do this, if you want something quick, eg to test an idea, and don’t want to edit directly in base is.


sort(v::AbstractVector; kws...) = (println("Hello world!"); sort!(copymutable(v); kws...))


julia> Base.include(Base.Sort, "mysort.jl");

julia> sort([2,1])
Hello world!
2-element Vector{Int64}:

Thanks! In this case, I want to contribute my changes upstream so editing the file directly is nice, but it’s also often nice not to. Is there a way to set up Revise to track mysort.jl in your example?

The docs for includet suggest that this is the way to do it.
Revise.track(Base.Sort, "mysort.jl"; mode=:eval, skip_include=false)

And this works. I’m not sure how valuable it is. Maybe it is.