我正在启动 REPL,然后include("./main.jl")多次使用以加速脚本加载。
第一次运行后,它开始发出警告:
WARNING: replacing module Lib.
WARNING: using Lib.somefn in module Main conflicts with an existing identifier.
Run Code Online (Sandbox Code Playgroud)
怎么压制呢?
您应该使用Reviseand then includet("./main.jl")(注意末尾的“t” includet,代表“track”)。从那时起,每当您对文件“main.jl”进行更改时,这些更改都会反映在 REPL 中,而不会发出警告。
例子:
module Lib
somefn() = 42
end #module
Run Code Online (Sandbox Code Playgroud)
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
Run Code Online (Sandbox Code Playgroud)
注意:如果Revise您的系统上尚未安装,您可能需要先安装它:
julia> using Pkg
julia> Pkg.add("Revise")
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
438 次 |
| 最近记录: |