[Top][All Lists]

[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: Fri, 11 Sep 2020 11:18:36 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0

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

OK, I think understand now.

So, when evaluating obj.X(end), we don't need to look up fields/properties of
obj to check whether X is a property or method and then do different things
depending on that result (because normally, END would not be valid in a call
to a function).

Instead, we just call subsref for the obj.X part and END will apply to the
result of that, whatever it is.  And that subsref evaluation may fail if, for
example, it actually determines that X is a method that requires arguments. 
If you change your subsref method to be

  function r = subsref(obj,S)
if (numel (S) == 1 && strcmp (S(1).type, '.') && strcmp (S(1).subs,
  error ('methodA called without arguments!');
      r = ones(1,3);

and then execute

obj.methodA (end)

do you see the error "methodA called without arguments!" or something else?


Reply to this item at:


  Message sent via Savannah

reply via email to

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