bugGNU Octave - Bugs: bug #50756, display of objects in cell arrays...


bug #50756: display of objects in cell arrays and structs is suppressed

Submitted by:  Mike Miller <mtmiller>
Submitted on:  Fri 07 Apr 2017 09:35:54 PM UTC  
Category: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Regression
Status: ConfirmedAssigned to: None
Originator Name: Open/Closed: Open
Release: devOperating System: GNU/Linux

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Sat 08 Apr 2017 06:42:12 PM UTC, comment #5:

Yeah understood. We definitely do want to keep the new behavior of showing the cell indices for each entry, if we keep cell display as it is.

I'd like to also point to #40211 and #43683, which are both about implementing complete overhauls of the way cell arrays are displayed by default. If either of these are done, this may become moot.

Mike Miller <mtmiller>
Project Administrator
Sat 08 Apr 2017 04:39:23 PM UTC, comment #4:

My attempt was a quick hack, not to be taken too seriously.

For example, with patch applied

But that is a regression from what we have today

Octave probably still needs to call os.print_with_name, but maybe needs to call display() to fill the temporary buffer buf.

Rik <rik5>
Project Administrator
Sat 08 Apr 2017 12:47:27 AM UTC, comment #3:

So if a class intentionally overrides both disp and display, or doesn't override disp, is it correct that we want display(c), where c is a cell array containing an object, to call disp(x) on the object, not display(x)?

The result of this decision is that the screen output of c may appear different from the screen output of c{1}.

I'm pointing this out because both the @pyobject class (in pytave) and the @sym class (in the symbolic package) have both disp and display overrides which give slightly different output. In both cases display does call disp, but it adds a bit of information about the type of the variable in addition to its text representation.

Mike Miller <mtmiller>
Project Administrator
Fri 07 Apr 2017 10:36:26 PM UTC, comment #2:

I changed the polynomial code to overload the disp function rather than the display function. This is how things should be done. See cset http://hg.savannah.gnu.org/hgweb/octave/rev/a5280a05b188.

However, that is only a prelude. You are correct that the issue is that the print routine for cells in ov-cell.cc is calling print directly on an octave_value object which does not seem to invoke overloaded version of either display or disp.

I made a quick hack using feval which calls disp() on the octave_value object. This works, but probably only jwe will know if this is the correct approach. See the attached hack.

(file #40326)

Rik <rik5>
Project Administrator
Fri 07 Apr 2017 09:45:49 PM UTC, comment #1:


Rik <rik5>
Project Administrator
Fri 07 Apr 2017 09:35:54 PM UTC, original submission:

With the changes that have been made to the way the display method is used, the following no longer shows the value of objects contained in a cell array.

In Octave 4.2.1, with the polynomial class provided in examples/code:

And on the default branch

If we do want the old behavior back, then I guess we need to arrange for octave_cell::print to make sure that the overloaded display method is called for each element that it contains, instead of going straight to its built-in print method.

Mike Miller <mtmiller>
Project Administrator


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):

Attached Files
file #40326:  50756.diff added by rik5 (997B - text/x-patch)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by mtmiller (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 10 Apr 2017 04:47:42 PM UTCrik5Summarydisplay of objects in cell array is suppressed=>display of objects in cell arrays and structs is suppressed
    Fri 07 Apr 2017 10:36:26 PM UTCrik5Attached File-=>Added 50756.diff, #40326
    Fri 07 Apr 2017 09:45:49 PM UTCrik5StatusNone=>Confirmed

    Back to the top

    Powered by Savane 3.1-cleanup1