从我自己的软件包内的参数导入@with_kw
我创建了我自己的julia package 我是这种做法的新手。
我以前有这个代码:
using Parameters
@with_kw mutable struct MWE @deftype String
mwe1 = "default" ; @assert mwe1 in ["default", "1", "2"]
mwe2 = "test"
end
效果很好。现在,我将其放入软件包中,用用导入
替换,我有以下错误:
julia> import MyPackageMWE
[ Info: Precompiling RobustRSP [33e6bdf6-6d3e-458b-9f4e-8cd6eb784281]
[ Info: Loading JuMP
[ Info: Loading Gurobi
[ Info: Loading Combinatorics, DelimitedFiles, Dates and Random
[ Info: Loading Distributions, Graphs and Plots
[ Info: Loading Parameters and Formatting
[ Info: Loading Compose, Cairo and Fontconfig
[ Info: Loading .jl files 0%
ERROR: LoadError: UndefVarError: @with_kw not defined
有什么想法出了什么问题? 也许与@macros有关?
I have created my own Julia package and I am new to such practices.
I previously had this code:
using Parameters
@with_kw mutable struct MWE @deftype String
mwe1 = "default" ; @assert mwe1 in ["default", "1", "2"]
mwe2 = "test"
end
Which worked well. Now that I put it into my package, replacing using
with import
, I have the following error:
julia> import MyPackageMWE
[ Info: Precompiling RobustRSP [33e6bdf6-6d3e-458b-9f4e-8cd6eb784281]
[ Info: Loading JuMP
[ Info: Loading Gurobi
[ Info: Loading Combinatorics, DelimitedFiles, Dates and Random
[ Info: Loading Distributions, Graphs and Plots
[ Info: Loading Parameters and Formatting
[ Info: Loading Compose, Cairo and Fontconfig
[ Info: Loading .jl files 0%
ERROR: LoadError: UndefVarError: @with_kw not defined
Any ideas what went wrong?
Maybe it is related to @macros?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道软件包参数,但可能是,如果@with_kw在参数中导出,则如果您
为
替换
@with_kw
带有参数。@with_kw
I don't know the package Parameters but it may be that if @with_kw is exported in Parameters then if you replace
with
then you should change
@with_kw
withParameters.@with_kw