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

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

[Octave-bug-tracker] [bug #64419] isequal fails for old-style @class obj


From: Rik
Subject: [Octave-bug-tracker] [bug #64419] isequal fails for old-style @class objects
Date: Wed, 12 Jul 2023 20:56:20 -0400 (EDT)

Follow-up Comment #1, bug #64419 (project octave):

The issue is traceable to the way isequal handles objects.  The function uses



s = builtin ("struct", obj);


to convert an object to a struct.  For classdef objects this returns a struct
where all properties (including read-only, etc.) are fieldnames along with
their value.

However, for old-style class objects this seems to return a confused struct
object which, when indexed, reverts back to a class object.


octave:2> a = audiorecorder ();
octave:3> typeinfo (a)
ans = class
octave:4> class (a)
ans = audiorecorder
octave:5> s = builtin ("struct", a)
s =

  scalar structure containing the fields:

    recorder = 0

octave:7> typeinfo (s)
ans = scalar struct
octave:8> class (s)
ans = struct
octave:9> y = s.recorder
error: struct: additional arguments must occur as "field", VALUE pairs
error: called from
    __get_properties__ at line 36 column 13
    disp at line 35 column 3
y = audiorecorder object with properties:

octave:10> typeinfo (y)
ans = audiorecorder
octave:11> class (y)
ans = audiorecorder


I think the issue needs to be resolved in struct().  Given that the call 


obj = class (STRUCT, "classname")


creates an old-style class object, it should be relatively easy to revert back
to a struct.

Adding jwe to the CC list because this is plain-old weird.


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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