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: John W. Eaton
Subject: [Octave-bug-tracker] [bug #58953] Error with 'end' in index expression with nested function calls
Date: Wed, 9 Sep 2020 16:14:00 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0

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

OK, I see how this might be handled, but I'm now wondering whether we have a
more basic error in the indexing logic for objects.

Given the following class:



classdef myclass
  properties
    data
  end
  methods
    function obj = myclass (data)
      obj.data = data;
    end
    function r = methodA (obj, val)
      r = val;
    end
    function r = subsref (obj, S)
      S.type
      S.subs
    end
  end
end


What does Matlab display if you execute the following code?


obj = myclass (13)
obj.methodA (42)
methodA (obj, 42)


Is the user-defined subsref method involved in either of the calls to methodA?
 Or does Matlab convert the obj.methodA(42) call to be methodA(obj,42) and
skip calling subsref (because in that case, we are not indexing an object)?

In Octave, we are calling the user-defined subsref in the first case but not
the second.  What does Matlab say is supposed to happen here?

    _______________________________________________________

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]