ERROR: Method overwriting is not permitted during Module precompilation. Use `__precompile__(false)` to opt-out of precompilation

Great explanations thanks!

In this case, how could I resolve Warnings for : Relevancestacktrace.jl

[ Info: Precompiling RelevanceStacktrace [6c8a4c8a-cd07-4735-95b7-b1ced2eaf8fd]
WARNING: Method definition show_full_backtrace(IO, Array{T, 1} where T) in module Base at errorshow.jl:598 overwritten in module RelevanceStacktrace at /home/master/repo/julia-awesomeness/RelevanceStacktrace.jl/src/RelevanceStacktrace.jl:151.
ERROR: Method overwriting is not permitted during Module precompilation. Use `__precompile__(false)` to opt-out of precompilation.
[ Info: Skipping precompilation since __precompile__(false). Importing RelevanceStacktrace [6c8a4c8a-cd07-4735-95b7-b1ced2eaf8fd].

What would you suggest then in this case?

If I put it in the init()

__init__() = begin 
  Base.show_full_backtrace(io::IO, trace::Vector; print_linebreaks::Bool) = show_full_backtrace_relevance(io, trace, print_linebreaks)
end

then I got another problem:

[ Info: Precompiling RelevanceStacktrace [6c8a4c8a-cd07-4735-95b7-b1ced2eaf8fd]
ERROR: LoadError: syntax: Global method definition around /home/master/repo/julia-awesomeness/RelevanceStacktrace.jl/src/RelevanceStacktrace.jl:153 needs to be placed at the top level, or use "eval".
.......

eval for me really discouraged, then even having the warnings sounds better I guess.

__precompile__(false) also an option but also it isn’t nice as it can cause a lot of precompilation issue by time for other packages.

What to do when we really wants to overload another package’s function and wants to take the invalidations for that action if it cannot be handled better?

1 Like