On Fri, May 24, 2024 at 12:39 PM Allin Cottrell <cottrell(a)wfu.edu> wrote:
On Fri, 24 May 2024, Sven Schreiber wrote:
> I've come across a strange piece of code which goes more or less like this:
>
> <hansl>
> open denmark
> matrix M = zeros($nobs,2)
> series M[1,] = ones(1,2)
> print M
> </hansl>
>
> Note the "series" specifier in the third line. I would have
> expected an error there, but this works with the same result as if
> "matrix" were given there. (Or nothing.) This is with gretl 2024b.
>
> So what's the point? I think a type mismatch error would be the
> right thing for a statically typed language like hansl.
It would indeed, and now that's the case in git. It was quite tricky
to get right, since there are formulations (not this one, of course)
that might look wrong but are quite acceptable [...]
To be more explicit: in a statement like
series LHS = RHS
LHS doesn't have to be a plain identifier; it can be a sub-object
specification. But my fix is based on the assumption that only two
gretl types can have a series as a sub-object, namely lists and
bundles. Trying to specify a sub-object of any other object type as a
series should provoke an "incompatible types" error.
Allin