[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #60726] nargout for {} in subsref() method doe
From: |
Fernando |
Subject: |
[Octave-bug-tracker] [bug #60726] nargout for {} in subsref() method does not match MATLAB |
Date: |
Tue, 24 Dec 2024 11:08:29 -0500 (EST) |
Follow-up Comment #7, bug #60726 (group octave):
I have identified two more cases where nargout in Octave is different from
nargout in Matlab. Applying the patch from file #56712 also eliminates the
differences in those two cases (as well as the case from comment #5).
To see the two cases, we can define this simple class:
classdef class_bug60726 < handle
methods
function varargout = subsref(obj, s)
varargout = num2cell(repelem(nargout,max(nargout,1)));
end
end
end
In Octave:
octave:> x(1).a
ans = 0
octave:> x{1}.a
ans = 0
In Matlab (or Octave with patch from file #56712 applied)
>> x(1).a
ans = 1
>> x{1}.a
ans = 1
There might be more corner cases, and it may be debatable whether Matlab's
answer is better than Octave's, but I think it is good to increase
compatibility.
I am attaching a patch that includes the changes from file #56712 and also
some test cases.
(file #56713)
_______________________________________________________
Additional Item Attachment:
File name: bug-60726.patch Size: 6KiB
<https://file.savannah.gnu.org/file/bug-60726.patch?file_id=56713>
AGPL NOTICE
These attachments are served by Savane. You can download the corresponding
source code of Savane at
https://savannah.gnu.org/source/savane-d58233b6feaa780411f7f09b695724cabce7bc1d.tar.gz
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?60726>
_______________________________________________
Mensaje enviado vía Savannah
https://savannah.gnu.org/
signature.asc
Description: PGP signature