On Sat, 16 Jan 2016, Sven Schreiber wrote:
Am 16.01.2016 um 22:22 schrieb Allin Cottrell:
> Internally, if an expression specifies a sub-matrix (e.g. "m[1:1]") its
> result is treated as a matrix, even if it's 1x1. However, if a 1x1
> result is assigned to a variable of unspecified type, as in the first
> "g" line above, it is "cast" to a scalar.
I have absolutely no idea about the internals here (as you know). But
why actually isn't it done the other way around? If the internal default
is matrix, why not choose that default also for an unspecified type
assignment, and then later convert it to scalar if needed?
Yes, that's the other alternative. But I just find it annoying and
unintuitive that if I say something like
bconst = $coeff[1]
then bconst is a matrix. To me, it looks ugly and stupid when gretl
"messages" are turned on (though it doesn't matter much if they're
turned off).
> You will get an "incompatible types" error on the last
line, since you
> stated that g is supposed to be a scalar. Only the "imputed" scalar type
> is taken as mutable, and to matrix only.
What about scalar versus series? "x = 5" can also mean either. Is this
also covered by the changes?
No. I believe it has always been clear that if you want a series of
constant value 5 you must say
series x = 5
or
x = 5 * const
and I don't see any reason to change that.
Allin