如何从 Julia 中的包扩展导出符号?

问题描述 投票:0回答:1

像这样设置一个简单的包扩展:

src/Plotting.jl:

module Plotting

function plot(x::Vector)
    # Some functionality for plotting a vector here
end

end # module

ext/PlottingContourExt.jl(也可以在 ext/PlottingContourExt/PlottingContourExt.jl 中):

module PlottingContourExt # Should be same name as the file (just like a normal package)

using Plotting, Contour

function Plotting.plot(c::Contour.ContourCollection)
    # Some functionality for plotting a contour here
end

function newfunction()
   ...
end

end # module

我怎样才能

export
newfunction
?简单地在
export newfunction
模块中添加
PlottingContourExt
似乎不起作用。

package julia
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.