octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #60791] classdef subsasgn / subsref called inc


From: Ray Zimmerman
Subject: [Octave-bug-tracker] [bug #60791] classdef subsasgn / subsref called incorrectly
Date: Thu, 17 Jun 2021 13:37:08 -0400 (EDT)
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1 Safari/605.1.15

URL:
  <https://savannah.gnu.org/bugs/?60791>

                 Summary: classdef subsasgn / subsref called incorrectly 
                 Project: GNU Octave
            Submitted by: rdzman
            Submitted on: Thu 17 Jun 2021 05:37:07 PM UTC
                Category: Interpreter
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: 6.2.0
         Discussion Lock: Any
        Operating System: Any

    _______________________________________________________

Details:

The subsasgn and subsref methods of a classdef object can be called from
within methods of the class by saving a handle to the constructor.

The following example should never call the class's subsasgn method, but it
does call it on the second call to the constructor.


classdef rdz_table
    properties
        p
    end
    methods
        function obj = rdz_table(val)
            obj.p = val;
        end
        function obj = subsasgn(obj, s, b)
            disp('yikes')
        end
    end
end



disp('1')
T1 = rdz_table(1);
cls = @rdz_table;
disp('2')
T2 = rdz_table(2);
disp('3')


Commenting out the line that assigns cls makes the problem go away. I believe
it also affects subsref, since the following results in a mistaken call to
subsasgn which subsequently mistakenly calls subsref resulting in a recursion
limit.


pkg load tablicious
T1 = table(1);
cls = @table;
T2 = table(2);


This example above works fine on 5.2.0. FYI, I've only tested this on macOS,
but I suspect it applies to all OSs.




    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?60791>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]