bugGNU Octave - Bugs: bug #32772, subsref only expects one argument...

 
 

bug #32772: subsref only expects one argument out

Submitter:  Vincent Rabaud <vrabaud>
Submitted:  Sun 13 Mar 2011 11:22:44 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Wont Fix Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 3.4.0 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 27 Jan 2014 01:56:35 AM UTC, comment #2: 

Oh, and looking at this one more time, I actually got this to work with the following change to @MyObject/subsref:


function varargout = subsref (my_object, idx)
  [a,b] = do_something (my_object)
  varargout{1} = a;
  varargout{2} = b;
endfunction


That seems like a usable workaround to me.

Mike Miller <mtmiller>
Group Member
Mon 27 Jan 2014 01:49:39 AM UTC, comment #1: 

I notice this bug hasn't received any attention or further comments. I also notice the page linked to on TMW website is no longer there. I think the preferred way to do what you are requesting in Matlab now is to define classes using the classdef syntax. Work is currently underway to support classdef classes in Octave. I suspect the syntax your example uses is deprecated in Matlab now since classdef supersedes and improves on it.

I'm going to close this as won't fix, since there is probably little interest in implementing a deprecated feature now that classdef will be supported soon. Feel free to reply to keep this bug open if I'm misunderstanding.

Mike Miller <mtmiller>
Group Member
Sun 13 Mar 2011 11:22:44 PM UTC, original submission:  

When creating an object (cf tar file) in a @ folder, if subsref is overloaded, nargout is always 1 while it not necessarily is.

subsref is not only used to access data members but also to call member functions which can return more than one argument (as detailed on http://www.mathworks.com/help/techdoc/matlab_oop/brdqinq.html in the "Dot Notation vs. Function Notation" section).

The given tar file contains a bogus object that should not crash when called this way:
obj=MyObject;
[a,b]=obj.do_something(1);

Thank you, I love octave !

Regards,
Vincent

Vincent Rabaud <vrabaud>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #22919:  object.tar added by vrabaud (10KiB - application/x-tar)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by rik5 (Updated the item)
  • -email is unavailable- added by vrabaud (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-01-27 mtmiller StatusNone Wont Fix
        Open/ClosedOpen Closed
    2013-10-10 rik5 Item GroupSegfault, Bus Error, etc. Incorrect Result
    2011-03-13 vrabaud Attached File- Added object.tar, #22919

    Back to the top

    Powered by Savane 3.13-aa77.
    Corresponding source code