>> ## no-print ##
>>
>> (see section 6 in
>>
http://gretl.sourceforge.net/papers/addons.pdf ) This signals
>> to gretl that the function does not print its own results, in
>> which case gretl will take care of calling the package's
>> bundle-print function. (We don't want both of these things to
>> happen.)
>
> Somehow my feeling is that it would be good to not have this new syntax.
> Or maybe it's the "mis-use" of the comment characters. Maybe instead a
> specially named argument instead?
> (Example:
> function bundle olsbundle (series y, list X, bool addon_no_print[1]) )
Fair point: the use of a special comment in this context is ad
hoc and potentially fragile. Another possibility would be to
make "no-print" a property of a packaged function that can be
set via the package's .spec file (and preferably also via the
function-packager GUI).
In a "real life" counterpart of olsbundle a standard idiom
would be to include a boolean parameter for printing or not in
the olsbundle() function -- hence giving a choice to the user
calling this function via script -- and to supply a wrapper
function (defined as "gui-main") which calls olsbundle() with
that flag set appropriately (presumably, with printing on). In
that case it would be the wrapper function that wants the
no-print flag.
I have now written at least a dozen of sets of scripts which use the
bundle to store pretty much everything and implement estimators/tests/etc.
In my experience, the best way to proceed (at least in a project which
involves more than a hundred lines of hansl code) is to have 3 separate
functions: one for populating the bundle with the reuslts (estimates etc
-- call it A), one for printing out the results (call it B) and a third
one, which acts as a wrapper, like
function bundle C(..., int verbosity)
bundle mod
...
A(&mod, <whatever>)
if verbosity>1
B(&mod)
endif
return mod
end function
So you have the choice of using the GUI to call function C, or you can
simply call A() if you don't care about viewing the results (like in a
Monte Carlo experiment, or because it's just an intermediate good to what
you want).
This is basically the way the gig and SVAR add-ons work, and quite happy
about it.
-------------------------------------------------------
Riccardo (Jack) Lucchetti
Dipartimento di Scienze Economiche e Sociali (DiSES)
Università Politecnica delle Marche
(formerly known as Università di Ancona)
r.lucchetti(a)univpm.it
http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------