bugGNU Octave - Bugs: bug #50671, Object arrays don't work correctly...

 
 

bug #50671: Object arrays don't work correctly with linear indexing

Submitter:  Stephan Jaeckel <stephan8282>
Submitted:  Wed 29 Mar 2017 02:05:23 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  stephan8282 Open/Closed:  * Closed
Release:  * 4.2.1 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 07 Apr 2017 06:22:50 PM UTC, comment #4: 

The patch in bug #46660 is pushed and this is now working correctly.
Closing report as fixed.

Markus Mützel <mmuetzel>
Group administrator
Wed 29 Mar 2017 08:35:35 PM UTC, comment #3: 

Probably is.  I added bug #46660 as a dependency.

Rik <rik5>
Group administrator
Wed 29 Mar 2017 07:33:57 PM UTC, comment #2: 

Might be related to bug #46660.

Markus Mützel <mmuetzel>
Group administrator
Wed 29 Mar 2017 06:49:42 PM UTC, comment #1: 

Confirmed, although the actual problem is a bit different.  The problem seems to be that the interpreter isn't handling linear indexing correctly.  See the diary from the session below and note that linear indexing is changing the size of the array.


octave:40> clear all
octave:41> d(1) = dummy
d =

<object array dummy>

octave:42> size (d)
ans =

   1   1

octave:43> d(1).name = "TEST"
d =

<object array dummy>

octave:44> size (d)
ans =

   1   2

octave:45> d(1).name
ans = bla
octave:46> d(2).name
ans = TEST


Note that if you use explicit ROW,COLUMN indexing then assignment works correctly.


octave:1> clear all
octave:2> d(1,1) = dummy
d =

<object array dummy>

octave:3> size (d)
ans =

   1   1

octave:4> d(1,1).name = "TEST"
d =

<object array dummy>

octave:5> size (d)
ans =

   1   1

octave:6> d(1,1).value = pi
d =

<object array dummy>

octave:7> size (d)
ans =

   1   1

octave:8> d(1,1).name
ans = TEST
octave:9> d(1,1).value
ans =  3.1416
octave:10> diary off



Rik <rik5>
Group administrator
Wed 29 Mar 2017 02:05:23 PM UTC, original submission:  

When setting properties of an element in an object array, other properties of the same object get retested to their default values. This only happens with arrays of objects.

Minimal classdef:

classdef dummy < handle

    properties
        name = 'bla';
        value = 1;
    end

end


Example:

% Works
clear d
d = dummy
d.name = 'test';
d.value = 2;
d.name % Should be 'test' --> OK

% Doesnt work
clear d
d(1) = dummy
d(1).name = 'test';
d(1).value = 2;
d(1).name % Should be 'test', but is 'bla'

% Possible temporary workaround
clear d
d(1) = dummy

d_tmp = d(1);
d_tmp.name = 'test';
d_tmp.value = 2;

d(1) = d_tmp;
d(1).name % Correct
d(1).value % Correct


Stephan Jaeckel <stephan8282>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Digest:
   bug dependencies.

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by stephan8282 (Submitted the item)
  • -email is unavailable- added by stephan8282
  •  

    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.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-04-07 mmuetzel StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2017-03-29 rik5 Dependencies- Depends on bugs #46660
    2017-03-29 rik5 CategoryOctave Function Interpreter
        StatusNone Confirmed
        SummaryWriting of property values in object arrays delets all other property values Object arrays don't work correctly with linear indexing
    2017-03-29 stephan8282 Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code