This is partly in response to Sven's posting at
http://lists.wfu.edu/pipermail/gretl-devel/2015-October/006196.html
but I thought that for future reference it might be more easily
found under its own subject line.
Up till now it has not been possible to specify the type of a bundle
member when assigning to it. You could say, for bundle b,
b.x = 0
or
b.m = I(3)
or whatever, but in each case the type of the resulting bundle
member would be decided by the "natural" type of the right-hand side
(RHS) expression (a scalar in the first case above, a matrix in the
second). In most cases this hasn't been a problem, but there's a
case for being able to specify the type in advance.
For one thing there's error-checking: you may have a specific type
in mind, and you'd like to know if the RHS value fails to match that
type right away (rather than waiting until the mismatch generates an
error that's hard to understand later on). For another, you might
want to force a type conversion, if possible. For example, outside
of a bundle you can say
series x = 0
to get a series variable with constant value 0, when the RHS
"naturally" yields a scalar.
Now (in git) you can do this. For example
bundle b
series b.s = 0 # expand scalar to series: OK
or
scalar b.x = I(3) # incompatible type on RHS: error!
The case that relates particularly to Sven's posting may be
illustrated as follows:
<hansl>
open denmark
bundle b
list L = LRM LRY
matrix b.mat = L
</hansl>
The point here is that you cannot put a list, as such, into a
bundle. There are compelling reasons for this prohibition (which I
can explain if they're not obvious), but nonetheless a savvy hansl
coder might want to put a matrix that represents a list into a
bundle temporarily (and take responsibility for ensuring that the
matrix will subsequently be interpreted as a list only if that
really makes sense in context).
In the example above the list L contains series 1 and 2 from the
"denmark" dataset and so translates to the matrix {1, 2}. Without
the new amendment one would have to do
<hansl>
open denmark
bundle b
list L = LRM LRY
matrix m = L
b.mat = m
</hansl>
which is a bit more roundabout that one would like, and leaves a
redundant matrix "m" lying around.
Allin