On Thu, 12 Aug 2021, Sven Schreiber wrote:
Am 02.06.2021 um 00:45 schrieb Sven Schreiber:
> Secondly, however, if I want to stuff such a single string into a bundle
> as an array, I get an error:
> <hansl>
> bundle b = null
> strings b.S = "A" # error: expected strings, got string
> </hansl>
>
> Note that doing this without the bundle works fine, as expected:
> <hansl>
> strings aS = "A"
> print aS # gives 1-element strings array
> </hansl>
Another dangling thread...
Is the first thing a bug? Not sure, as in principle you might say that
the second thing isn't really supported, we just got lucky.
My take would be "just got lucky". I don't think "as expected"
applies
here; it's nowhere documented that you can create an array just by
providing a single object. Admittedly there's a deliberate bit of
internal coding that supports this in the simple case, but I'm not
sure it's a good idea. It would be quite tricky to generalize it fully
(allowing it for array-elements as well as bundle-members, and for
inflected assignment).
My inclination would be remove auto-promotion of obj to array-of-obj
and insist on defarray(), but if that creates a compatibility problem
just leave things as they are.
Allin