Testing modifications to Base

Do I recall on one of these threads that there is a way to easily test Base modifications without rebuilding Julia? Can’t find it through search, so maybe my memory is off…

What kind of modifications do you have in mind?

You can easily override any method definition you want without doing anything special (piracy is easy!):

Base.+(x::Int, y::Int) = 42

For larger chunks of code, something you might want to do is put everything you want to override in a file (maybe by copy-pasting some original Base source code and modifying it), then

Base.include("overrides.jl")

The source code will then be evaluated within the Base module.

3 Likes

I want to test out a background-threading mod for https://github.com/JuliaLang/julia/issues/34267. Thanks for the help!

1 Like

I had to make some changes in the Distributed module some time ago. I did this by @eval Distributed function ... end

Revise works, but you have to ask for this explicitly:

https://timholy.github.io/Revise.jl/stable/#What-Revise-can-track-1

1 Like

Moreover, Keno recently added test targets that use Revise, e.g., make test-revise-reducedim from the unix prompt.

2 Likes