Inconsistency in similary actions
Originally reported in #37 (closed)
The problem code is the following. The first block works without problem, the second fails.
zero = dseries(zeros(8,1), '2011q1'); % Modifying all of b (this works) a = dseries((1:8)', '2011q1'); b = a; b = b + 1; assert(~all(a - b == zero)); % Modifying only part of b (this does not work as it modifies a as well) a = dseries((1:8)', '2011q1'); b = a; b(dates('2012q2'):dates('2012q4')) = b(dates('2012q2'):dates('2012q4')) + 1; assert(~all(a - b == zero), 'a and b should not be equal here');
This is a problem because seemingly similar code works inconsistently without the user's knowledge.
I understand there are no good solutions to this: either slow down the code by making copies everywhere, thus returning it to the old, structure-style class setup that Matlab had, or accept to have this bug. We may have to choose an un-ideal option here.....