[Gretl-devel] scalar function args and NAs

Riccardo (Jack) Lucchetti r.lucchetti at univpm.it
Sun Jul 5 14:14:17 EDT 2015


On Sun, 5 Jul 2015, Allin Cottrell wrote:

> A question has come up as I've thought about user-function arguments (see 
> also
> http://lists.wfu.edu/pipermail/gretl-devel/2015-July/005850.html )
>
> Given a scalar parameter, what do we want to do if the caller supplies NA as 
> an argument? What difference, if any, should it make if the parameter is 
> marked as "bool" or "int" rather than plain "scalar"?
>
> The situation prior to my changes of the last couple of days was that
> NA was always accepted. But along with fixing the bounds checking for scalar 
> arguments, I banned NA for bool and int parameters. I've now had second 
> thoughts (maybe this would break some existing scripts?) and have reverted to 
> the status quo ante.
>
> But maybe this is something we want to think about. Are there real use-cases 
> where a function writer would want to accept NA for a bool or int argument? 
> Or would it be more convenient for the writer not to have to bother with 
> checking for NAs, in the knowledge that they would be ruled out by gretl?

My very personal position is not to check automatically. It shifts the 
burden on "do the right thing" on the function writer, who should bear 
responsibility for what she does.

Besides, NA could very well be an idiomatic way of saying "make some 
automatic choice", which can be very useful at times (think for example 
lags in a unit-root test).

-------------------------------------------------------
   Riccardo (Jack) Lucchetti
   Dipartimento di Scienze Economiche e Sociali (DiSES)

   Università Politecnica delle Marche
   (formerly known as Università di Ancona)

   r.lucchetti at univpm.it
   http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------


More information about the Gretl-devel mailing list