bugGNU Octave - Bugs: bug #32060, Accessing OO properties in...

 
 

bug #32060: Accessing OO properties in subfunction of a private class method

Submitter:  Guillaume <gyom>
Submitted:  Wed 05 Jan 2011 03:50:57 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Guillaume Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 06 Jan 2011 02:08:06 PM UTC, comment #2: 

It now works for me as well. Thanks.

Guillaume <gyom>
Wed 05 Jan 2011 09:19:13 PM UTC, comment #1: 

I checked in the following changeset:

http://hg.savannah.gnu.org/hgweb/octave/rev/40f311a69417

This change seems to fix the problem for me, so I'm closing this report.

John W. Eaton <jwe>
Group administrator
Wed 05 Jan 2011 03:50:57 PM UTC, original submission:  

Accessing fields of an object should be done directly from within a method (ie not calling subsref/subsasgn): while this is the case for a public class method and for a private class method (see:
https://savannah.gnu.org/bugs/?30909), it is not for a subfunction of a private class method.

This can be reproduced with the following code:

==================== @testclass/testclass.m ====================
function obj = testclass(varargin)
obj = struct('public',1, 'private',0);
obj = class(obj,'testclass');

==================== @testclass/subsref.m ====================
function dat = subsref(obj,subs)
switch subs.type
    case '.'
        switch subs.subs
            case 'public'
                %dat = obj.param;
                dat = param(obj);
            otherwise
                error('err');
        end
    otherwise
        error('err');
end

==================== @testclass/private/param.m ====================
function dat = param(obj)
%dat = obj.public; % direct access => works
dat = param2(obj); % => subfunction calls subsref => crash

function dat = param2(obj)
dat = obj.public; % calls subsref...

========================================
octave> a = testclass;
octave> a.public

results in an infinite loop param<->subsref in Octave, while this works as expected in MATLAB.

Guillaume <gyom>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by gyom (Submitted the item)
  • -email is unavailable- added by gyom
  •  

    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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-01-05 jwe StatusNone Fixed
        Open/ClosedOpen Closed
    2011-01-05 gyom Carbon-Copy- Added highegg

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code