[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #54800] Class method invocation errors
From: |
Amro |
Subject: |
[Octave-bug-tracker] [bug #54800] Class method invocation errors |
Date: |
Sun, 7 Oct 2018 07:07:36 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0 |
URL:
<https://savannah.gnu.org/bugs/?54800>
Summary: Class method invocation errors
Project: GNU Octave
Submitted by: amro_octave
Submitted on: Sun 07 Oct 2018 02:07:34 PM EEST
Category: Interpreter
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Unexpected Error
Status: None
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: 4.4.1
Operating System: Any
_______________________________________________________
Details:
I recently upgraded to Octave 4.4.1, and I noticed unexpected errors when
invoking a classdef object method.
Take this simple class definition (constructor, destructor, and a method):
classdef MyClass < handle
methods
function this = MyClass()
disp('-- MyClass.MyClass')
end
function delete(this)
disp('-- MyClass.delete')
end
function x = func(this)
disp('-- MyClass.func')
x = 1;
end
end
end
All the following should work for calling the class method:
obj = MyClass();
x = obj.func()
clear obj
obj = MyClass();
x = func(obj)
clear obj
x = MyClass().func()
x = func(MyClass())
But the last two are failing with:
"error: value on right hand side of assignment is undefined"
Interestingly, if I remove the destructor from the class (i.e "delete"
function), the last two invocations work again.
In comparison, all the above cases work as expected in MATLAB (dot notation
vs. function notation call, as well as using a temporary variable to store the
object vs. not)
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?54800>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #54800] Class method invocation errors,
Amro <=