On Mon, Nov 4, 2024 at 7:07 PM Sven Schreiber <sven.schrei...@fu-berlin.de> wrote: > > Am 05.11.2024 um 00:38 schrieb Sven Schreiber: > > <hansl> > > matrix m = {0.5} > > eval typename(m) # matrix > > b = _(hu=m) > > eval typename(b.hu) # scalar > > </hansl> > > > > So the mere copy of the object changes its type here. (Also happens > > outside of a bundle, but there you can force the type more easily.) > > OK, so the only way I'm seeing to force and preserve the matrix type is > via a pre-created bundle and then a separate copy, and then even without > explicit type declarations: > > <hansl> > clear > bundle B > m = {0.5} > B.m2 = m > eval typename(B.m2) # matrix > </hansl>
Hmm, the fact that we don't auto-convert a 1x1 matrix to scalar in your second case, but we do when the matrix figures as an argument to defbundle() / _() seems like a nasty inconsistency. In git I've cancelled that conversion. I think this should be "safer", in that there are probably more contexts where a scalar can't do the job of a matrix than vice versa (even though we've tried to minimize such discrepancies). But we need to watch out for any unwanted side effects. Allin _______________________________________________ Gretl-devel mailing list -- gretl-devel@gretlml.univpm.it To unsubscribe send an email to gretl-devel-le...@gretlml.univpm.it Website: https://gretlml.univpm.it/postorius/lists/gretl-devel.gretlml.univpm.it/