bugGNU Octave - Bugs: bug #66270, subsasgn and subsref can not use...

 
 

bug #66270: subsasgn and subsref can not use ('key') operator to access containers.Map

Submitter:  Qianqian Fang <fangq>
Submitted:  Sat 28 Sep 2024 07:13:13 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  None Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * 9.1.0 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 30 Sep 2024 04:47:36 PM UTC, comment #1: 

Use:


a=containers.Map();
subsasgn(a, struct('type', '()', 'subs', {{'testkey'}}), 1)


and


a('test')=1
subsref(a, struct('type', '()', 'subs', {{'test'}}))


subsref and subsasgn in containers.Map should be updated to also accept a character array and not just a cellstr.

Anonymous
Sat 28 Sep 2024 07:13:13 PM UTC, original submission:  

The following subsasgn command fails on Octave (5.x - 9.x) but works fine on MATLAB


a=containers.Map();
subsasgn(a, struct('type', '()', 'subs', 'testkey'), 1)


octave error:


 error: sq_string cannot be indexed with {
 error: called from
    subsasgn at line 462 column 15


 
similarly, the ('testkey') operator also fails to work in subsref to retrieve values if the key exist


 a('test')=1
 subsref(a, struct('type', '()', 'subs', 'test'))


octave error:


 error: sq_string cannot be indexed with {
 error: called from
    subsref at line 432 column 15


expected behavior: if mapname('test') can be assigned and retrieved, the subsasgn and subsref interfaces should allow () operator with a string-valued key.

Qianqian Fang <fangq>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by fangq (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-5884.
    Corresponding source code