Thanks, I wasn’t aware of the 2nd thread. No surprise this has a bigger scope of package system. In that regard, perhaps we can do a better job than #include
. I like the option suggested in the thread that we can do
import FooPackage // equal to #include <FooPackage.hpp>
functions{
matrix FooPackage::foo(func bar, vector x);
matrix FooPackage::bar(vector x);
}
as it gives us chance to allow
import FooPackage // equal to #include <FooPackage.hpp>
import BarPackage // when we have package system ready, BarPackage would be a Stan package.
functions{
matrix FooPackage::foo(func bar, vector x); // we may not even need to declare foo or bar.
matrix BarPackage::bar(vector x);
}
Then the syntax would be consistent.
For that to work, first we have to go extra mile beyond rstan, to add keyword import
& ::
in stanc3.
EDIT: related conversion Helpful function repository , in particular Helpful function repository - #7 by bbbales2