[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #54028] copy of non-handle class instance is n
From: |
A.R. Burgers |
Subject: |
[Octave-bug-tracker] [bug #54028] copy of non-handle class instance is not deep |
Date: |
Thu, 31 May 2018 17:36:38 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 Edge/16.16299 |
URL:
<http://savannah.gnu.org/bugs/?54028>
Summary: copy of non-handle class instance is not deep
Project: GNU Octave
Submitted by: arb
Submitted on: Thu 31 May 2018 09:36:37 PM UTC
Category: Interpreter
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Matlab Compatibility
Status: None
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: 4.4.0
Operating System: Any
_______________________________________________________
Details:
Copying a class does not create a copy of an object array property, where as
matlab does make a deep copy in this case.
classdef b
properties
a_array;
end
end
classdef a
properties
ap = 1;
end
end
a script use_b.m that attempts a copy of an instance of class b, where a_array
is an object array.
ver = version()
bi = b();
bi.a_array = a;
bi.a_array(end+1) = a;
% make copy of bi to bi_copy
bi_copy = bi;
% change first element of object array in copy
bi_copy.a_array(1).ap = 2;
% report first element of object array in original
bi.a_array(1).ap
output with octave
ver = 4.4.0
ans = 2
output with matlab
ver = 8.6.0.267246 (R2015b)
ans = 1
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?54028>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Octave-bug-tracker] [bug #54028] copy of non-handle class instance is not deep,
A.R. Burgers <=