[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #53911] default implementation of 'eq' for han
From: |
Richard |
Subject: |
[Octave-bug-tracker] [bug #53911] default implementation of 'eq' for handle classes |
Date: |
Tue, 15 May 2018 14:18:48 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/65.0.3325.181 Chrome/65.0.3325.181 Safari/537.36 |
Follow-up Comment #2, bug #53911 (project octave):
True, but I also need some way of uniquely identifying the instance, like
adding a random number property or something like this. I can probably come up
with something, but if there's some other method of uniquely identifying
objects that would be useful.
The default behaviour of isequal and == for handle classes is mentioned
briefly in this doc:
https://uk.mathworks.com/help/matlab/ref/handle.relationaloperators.html
A more comprehensive discussion is here:
https://uk.mathworks.com/help/matlab/matlab_oop/comparing-handle-and-value-classes.html
basically handle class has a default eq operator. == returns true if the
instances are the same, isequal returns true if the property values are the
same.
For value classes there is not a default eq operator, but isequal will return
true if the objects are of the same class and have the same property values.
There does seem to be a default ne operator for handle classes too:
>> y = x
y =
compare1 with properties:
foo: 1.0000e+000
>> x ~= y
ans =
logical
0
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?53911>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/