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

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

[Octave-bug-tracker] [bug #55976] cat, repmat, and reshape don't work fo


From: Andrew Janke
Subject: [Octave-bug-tracker] [bug #55976] cat, repmat, and reshape don't work for classdef objects
Date: Thu, 21 Mar 2019 20:52:25 -0400 (EDT)
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.75 Safari/537.36

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

                 Summary: cat, repmat, and reshape don't work for classdef
objects
                 Project: GNU Octave
            Submitted by: apjanke
            Submitted on: Fri 22 Mar 2019 12:52:24 AM 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
         Discussion Lock: Any
                 Release: 4.4.1
        Operating System: Any

    _______________________________________________________

Details:

It seems that cat, its [...] equivalent, reshape, and repmat are not working
for classdef objects. This is a bummer, because these are kind of basic
elements of OOP M-code programming if you're not going to go all the way and
make planar-organized objects.

Lets's say I have a class packajoozle.internalVersion with properties string,
elements, and suffix.
https://github.com/apjanke/octave-packajoozle/blob/679b4afc3e5e706f6b9ca259705102d0edc077e6/inst/%2Bpackajoozle/%2Binternal/Version.m
It does not override size, cat, reshape, numel, or any of the other structural
methods; it is a regular struct-organized object.

Trying to do [...], reshape, or repmat on it produces an Octave error.


>> addpath('~/local/repos/octave-packajoozle/inst')
>> ver = packajoozle.internal.Version('1.2.3')
ver =
1.2.3

>> [ver ver ver]
warning: struct: converting a classdef object into a struct overrides the
access restrictions defined for properties. All properties are returned,
including private and protected ones.
warning: struct: converting a classdef object into a struct overrides the
access restrictions defined for properties. All properties are returned,
including private and protected ones.
warning: struct: converting a classdef object into a struct overrides the
access restrictions defined for properties. All properties are returned,
including private and protected ones.
error: octave_base_value::parent_class_name_list(): wrong type argument
'object'
>> repmat(ver, [0 0])
error: octave_base_value::resize (): wrong type argument 'object'
error: called from
    repmat at line 108 column 9
>> repmat(ver, [4 1])
error: octave_base_value::reshape (): wrong type argument 'object'
error: called from
    repmat at line 111 column 9
>> reshape(ver, [1 1])
error: octave_base_value::reshape (): wrong type argument 'object'
>> ver(2) = ver
ver =
1-by-2 packajoozle.internal.Version

>>


That's from Octave 4.4.1. Same thing happens in Octave 5.1.0 and Octave
default 6.0.0 (hg id: 1771bed38482 + patches).




    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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