[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #59737] end keyword not passed to oveloaded su
From: |
anonymous |
Subject: |
[Octave-bug-tracker] [bug #59737] end keyword not passed to oveloaded subsfef function within custom classdef |
Date: |
Sun, 20 Dec 2020 18:02:38 -0500 (EST) |
User-agent: |
Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0 |
Follow-up Comment #2, bug #59737 (project octave):
Please change this bug report to a request to change documentation. I agree
this bug as reported is not a bug. Is it possible to add a sentence like:
If you would like to use the end keyword with subsref you will also need to
overload end.
and/or
add end to the see also list
See also: subsasgn, substruct, end.
The reason I overloaded every size function I could think of was to see if one
of them was being used by end. There was no hint in the documentation, the
syntax highlighter or from my google searches (I was not searching overload
end. I was searching my problem.) that I could overload end.
The working as expected class with overloaded end:
classdef cantuseend
properties
value;
endproperties
methods
function obj=cantuseend(a)
obj.value=a;
endfunction
function obj=subsref(a,s)
if strcmp(s.type,"()")
obj=cantuseend(subsref(a.value,s));
s
else
obj=builtin('subref',a,s);
end
endfunction
function display(a)
disp(a.value);
endfunction
function lastindex=end(a,k,n)
lastindex=size(a,k);
endfunction
function varargout=size(a,varargin)
nout=nargout;
if nout<=1
varargout={size(a.value,varargin{:})};
else
varargout=nthargout(1:max(nargout,1),@size,a.value,varargin{:});
end
end
endmethods
endclassdef
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?59737>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/