On Fri, 18 Jul 2008, Riccardo (Jack) Lucchetti wrote:
On Fri, 18 Jul 2008, Ignacio Diaz-Emparanza wrote:
> El Friday 18 July 2008 16:14:11 Riccardo (Jack) Lucchetti escribió:
> >
> > What happens here is that the list X contains a variable
> > whose name is "x". How is the ols command supposed to know
> > the difference between the series _internally_ named x
> > (argument 1) and the one passed via the list?
>
> Umm , I see, gretl cannot distinguish. And what about giving
> an oportunity to the function programmer to correct his proper
> errors? It is not enough with giving a warning?
The way I see it, there is no "error". Once you write a
function, that function is expected to work whatever the names
of its arguments are.
Yes. The function writer can't really "program defensively"
because he has no idea of how the list-member variables will be
named when the function is called. As I've said before, this is a
design flaw in the function/list relationship.
As a practical matter, for the present, though, a function writer
can reduce the probability of such clashes by using some sort of
specific naming convention for local variables in the case where a
list is accepted as an argument. For example, in function myfun
one might call a local variable "myfun_x" rather than the generic
"x".
Allin.