Interesting, so this is an alternative to the @unpack macro? For the macro I do need to load the package, right? At least I get an error.
Could you tell me why there is semicolon in the last line? I don’t understand the syntax.
s = MyStruct(1,"test")
creates a tuple, correct?
where can I read about the ;
in (; x, y) = s
?
Thanks!
@lmiq Okay, I think I am almost there.
So I added the struct definition hypChan2020
in the module and exported it. This allows me to neatly call the function without any arguments. Here is my syntax
function Chan2020_LBA(YY;hyp=hypChan2020,p::Integer=4,nburn::Integer=1000,nsave::Integer=2000)
end
then the user can just do
using BayesianVAR
Y_20 = readdlm("data/FRED_Chan2019.txt", ',');
Chan2020_LBA(Y_4)
Chan2020_LBA(Y_4,p=1,nburn = 100, nsave = 5000)
these all work and I also see hypChan2020() in the global scope.
However, I am struggling with the syntax from your referenced post.
For example, this doesn’t work
using BayesianVAR
Y_20 = readdlm("data/FRED_Chan2019.txt", ',');
hyper=hypChan2020()
Chan2020_LBA(Y_4,hyp=hyper())
and throws
ERROR: MethodError: objects of type hypChan2020 are not callable The object of type hypChan2020 exists, but no method is defined for this combination of argument types when trying to treat it as a callable object.
Also hyp is an immutable struct so I cannot change anything, but that is an easy fix.