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: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: None
Originator Name: GuillaumeOpen/Closed: Closed
Release: devOperating System: GNU/Linux

Add a New Comment (Rich MarkupRich 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:


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);

==================== @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 File(s):

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


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

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

    Only project members can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 05 Jan 2011 09:19:13 PM UTCjweStatusNone=>Fixed
    Wed 05 Jan 2011 03:50:57 PM UTCgyomCarbon-Copy-=>Added highegg

    Back to the top

    Powered by Savane 3.1-cleanup