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

 
 

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

Submitted by:  Guillaume <gyom>
Submitted on:  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

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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>
Project 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
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project 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.5