On Thu, 25 Feb 2010, Allin Cottrell wrote:
On Thu, 25 Feb 2010, Sven Schreiber wrote:
> Allin Cottrell schrieb:
>
>> mwrite(xy, "(a)dotdir/xy.mat")
>
> OT: I know about the return value of mwrite(), but this "feels" more
> like a command than a function. Or to put it differently: if I
> understand correctly you recently introduced more sophisticated error
> handling ($error and stuff). I wonder whether a mish-mash is being born
> right now, sometimes getting error codes from function return values,
> and sometimes from accessor variables?
I take your point that mwrite feels more like a command than a
function. One reason it was done as a function is so that it could
return an error code (rather than just bombing out on failure).
Now that we have "catch" (see the manual) that could be
reconsidered; but symmetry with mread (which is "naturally" a
function) would argue for function status for mwrite.
The gretl scripting language has grown through time considerably: the lack
of coherence, if you will, is a consequence of the fact that it had
started more as a convenience "batch" language to automate certain jobs,
and gradually has become more and more similar to a programming language.
Of course, since Allin and (to a much lesser extent) I were the people who
put the features in, IMO it's only natural that the closer you come to a
programming language proper, the more it looks like the programming
language that we like the most (ie C), where _literally everything_ is a
function.
My feeling is that if we were to redesign it from scratch, the scripting
language would be quite different, but... I don't have to explain the
value of backward compatibility to you, Sven, do I? :-)
>> colnames(h, "coherence")
>
> another function used like a command -- how many are there?
Use the source, Luke!
In this case, admittedly, there's not much justification for
function status -- other than a feeling of mine (anyone else?)
that it's better to keep the command namespace of manageable size.
I'm always somewhat reluctant to add a new command, but don't feel
quite the same constraint with functions.
100% agree.
Riccardo (Jack) Lucchetti
Dipartimento di Economia
Università Politecnica delle Marche
r.lucchetti(a)univpm.it
http://www.econ.univpm.it/lucchetti