I think everything you say is correct, though I'd have to run a check to verify. The general rule is that  $model inside a function can only refer to a model estimated previously within the same function - with the exception of the case of a function that attaches to a model window menu, where it gets access to the model whose window it is.

I hope that's reasonably clear.

On May 31, 2017 2:24 PM, "Sven Schreiber" <svetosch@gmx.net> wrote:
Am 31.05.2017 um 10:02 schrieb Allin Cottrell:
On Tue, 30 May 2017, Sven Schreiber wrote:

$model-style bundle as an argument. How do I have to specify the function signature or argument so that it is actually the $model bundle that is automatically handed over to the package?
I looked briefly in the package guide, but couldn't find an answer (I think).

Yep, it's not in the package guide yet. But it's straightforward: in your GUI interface function, just grab hold of $model and pass it to the function that actually does the business. I have an example that I was planning to share in the "code sprint" -- here's its "GUI main":

function bundle GUI_exogtest (int xvar[$mylist] "regressor to test")
   matrix ds = exogtest($model, deflist(xvar))
   return defbundle("test", ds[1], "df", ds[2], "pvalue", ds[3])
end function

Great, thanks! So if I understand correctly:

- I can use $model directly (without extra function arguments) within the public functions of the package that I assume will be invoked via the GUI.

- Or is the designation of "menu-attachment" for the package then mandatory? (In the package guide it says it's optional, but this may be a special case.)

- It is probably recommended to specify such functions as "menu-only" in the package?

- Just to be sure: $model within a function in a standard context is only valid if inside the same function something was estimated, not outside the function, right?

thanks,
sven

_______________________________________________
Gretl-devel mailing list
Gretl-devel@lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-devel