[bug #68108] classdef objects do not support creation of initialized arrays

FatYoshi17 <[email protected]>
Newsgroups gmane.comp.gnu.octave.bugs
Message-ID <[email protected]>
Please use the bug tracker to post updates to a bug report.  The mailing list is intended as a read-only notification stream.  Info posted to this mailing list address won't appear in the tracker database where it is most useful.

Follow-up Comment #2, bug #68108 (group octave):

i,

This patch adds support for comma-separated list assignment to properties of
classdef object arrays.

Previously, something like:

m(1,3) = mre ();
c = num2cell (1:3);
[m.A] = c{:};

would fail with
can't perform indexing operation on array of ... objects.

The issue was that cdef_object_array::subsasgn only handled case '.' when
numel () == 1, and otherwise fell through to the default error. The patch
extends this branch to accept a cs-list RHS and distributes the values across
the array elements by delegating to scalar subsasgn.

I’ve added a small regression test under
test/classdef/bug-objarray-cslist.tst
with a minimal helper class.

make check passes locally (FAIL 0).

Let me know if you'd prefer a different approach or if anything should be
adjusted.

Thanks!

(file #58294)

    _______________________________________________________

Additional Item Attachment:

Name: bug-objarray-cslist.patch      Size: 2.3KiB

<https://file.savannah.gnu.org/file/bug-objarray-cslist.patch?file_id=58294>


    AGPL NOTICE

These attachments are served by Savane. You can download the corresponding
source code of Savane at
https://savannah.gnu.org/source/savane-2a2ecc185bd672dd377a2efbb667431a4b30acc3.tar.gz


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?68108>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc (application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE-----

iHUEABYIAB0WIQQk97aszIMMAvLLwm6qLAuaBUf3TgUCaaVUmQAKCRCqLAuaBUf3
TsolAP9Krq5vvjEmvtYT8rD7uwF1Q4BWz0vatsU5Yz45FLoy2AD+JCVp9+5AlIhY
092wFaFkjuPPl2DKvoL2lgaNQFOTbAE=
=6mmn
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.