Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Suppress warning about conflict with existing identifier

Tags:

julia

I'm starting REPL and then using include("./main.jl") multiple times to speed up script loading.

After the first run it starts giving warnings:

WARNING: replacing module Lib.
WARNING: using Lib.somefn in module Main conflicts with an existing identifier.

How to suppress it?

like image 440
Alex Craft Avatar asked Oct 15 '25 15:10

Alex Craft


1 Answers

You should use Revise and then includet("./main.jl") (note the 't' at the end of includet, standing for "track"). From there on, whenever you make a change to file "main.jl", these changes are reflected in the REPL, without warning.

Example:

  • File main.jl:
module Lib

somefn() = 42

end #module
  • REPL:
julia> using Revise
julia> includet("main.jl")
julia> Lib.somefn()
42

# modify the definition of somefn in main.jl and save the file

julia> Lib.somefn()
43



NB: If Revise is not already installed on your system, you might have to install it first:

julia> using Pkg
julia> Pkg.add("Revise")
like image 136
François Févotte Avatar answered Oct 18 '25 21:10

François Févotte



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!