octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #58953] Error with 'end' in index expression w


From: Guillaume
Subject: [Octave-bug-tracker] [bug #58953] Error with 'end' in index expression with nested function calls
Date: Sat, 19 Sep 2020 06:28:59 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0

Follow-up Comment #45, bug #58953 (project octave):

jwe, I'm sorry I cannot be more helpful here. You seem to be very close to
fixing a number of issues though.

I tried to simplify my example to the maximum and I notice the issue happens
with old-style class but not classdef and the issue does not come up before
applying the patch.


classdef myclass5
  properties
    data
  end
  methods
    function obj = myclass5
      obj.data = 1;
    end
    function r = subsref(obj,s)
      switch s(1).type
        case '.'
          r = obj.data(end);
      end
    end
  end
end



# @myclass4/myclass4.m
function this = myclass4

  this = class (struct ('data', 1), 'myclass4');

end

# @myclass4/subsref.m
function r = subsref (obj, s)

  switch (s(1).type)
    case '.'
      r = obj.data (end);
  end
  
end



octave> obj = myclass4(); obj.data
error: max_recursion_depth exceeded
error: called from
    subsref
    subsref at line 5 column 9
octave> obj = myclass5(); obj.data
ans = 1


This means that unpatched Octave and Matlab use builtin when evaluating
obj.data in subsref whether there is an 'end' indexing or not. I am trying to
find in the Matlab documentation a description of when subsref is called from
within methods but couldn't so far.

    _______________________________________________________

Reply to this item at:

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

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]