[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #62077] classdef: cannot fully recover cleared
From: |
Kai Torben Ohlhus |
Subject: |
[Octave-bug-tracker] [bug #62077] classdef: cannot fully recover cleared object variable |
Date: |
Fri, 18 Feb 2022 04:55:46 -0500 (EST) |
URL:
<https://savannah.gnu.org/bugs/?62077>
Summary: classdef: cannot fully recover cleared object
variable
Project: GNU Octave
Submitted by: siko1056
Submitted on: Fri 18 Feb 2022 06:55:44 PM JST
Category: Interpreter
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Unexpected Error or Warning
Status: None
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Release: dev
Discussion Lock: Any
Operating System: Any
_______________________________________________________
Details:
Given the class
classdef bad_class
methods (Access = 'private')
function foo1(obj)
disp ('call foo1');
end
function foo2(obj)
disp ('call foo2');
clear all;
obj = evalin ('caller', 'obj');
disp (' clear all');
obj.foo1 ();
end
end
methods
function foo3(obj)
obj.foo2();
end
end
end
In member function `foo2` the command `clear all` clears all variables in the
current scope. This is conform with Matlab R2021a.
In Matlab one can recover the lost variable as described in `foo2`. In Octave
6.4.0, 7, and 8 the output is:
call foo2
clear all
error: subsref: method 'foo1' has private access and cannot be run in this
context
error: called from
foo2 at line 11 column 7
foo3 at line 16 column 7
A workaround is declaring everything as "public". Same problem with
"protected"
Similar to bug #56953.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?62077>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #62077] classdef: cannot fully recover cleared object variable,
Kai Torben Ohlhus <=