bugGNU Octave - Bugs: bug #46891, inputname fails in OO @classfile

 
 

bug #46891: inputname fails in OO @classfile

Submitted by:  Rik <rik5>
Submitted on:  Wed 13 Jan 2016 11:04:18 PM UTC  
 
Category: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Regression
Status: FixedAssigned to: None
Originator Name: Open/Closed: Closed
Release: devOperating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Thu 14 Jan 2016 04:37:08 PM UTC, comment #2:

It's not perfect, but I changed the display routine for FIRfilter to print the variable name. See http://hg.savannah.gnu.org/hgweb/octave/rev/c221ce56f774. Closing report.

Rik <rik5>
Project Administrator
Thu 14 Jan 2016 06:52:36 AM UTC, comment #1:

According to the help of inputname it is intended that it returns an empty string. Also the display method should not display the inputname and an equal sign if inputname returns an empty string.

For comparison:
````
s = struct ("a", 1, "b", 2);
display (s.a)
1 <-- see, no inputname printed
````

So the problem here is in the @FIRfilter/display.m method, which should itself do (again causing the same problem one level higher)
````
fprintf ("%s.polynomial = %s", inputname (1));
````

In general it is impossible to implement a correct display method in an m-file, because you do not have access to the current level of indentation (which you will need when the object is displayed in a struct or cell array). The best that I could come up with is this: https://sourceforge.net/p/octave/interval/ci/0d2d616f126b3fa5257b7d70455704e6f4e4c25a/tree/inst/@infsup/display.m#l75 (it works for cell arrays on the first level of indentation)

Finding this kind of regressions is very simple using the doctest package. It is still on my to-do list to migrate its functionality into the `test` function in Octave core.

Oliver Heimlich <oheim>
Wed 13 Jan 2016 11:04:18 PM UTC, original submission:

Documentation on the old object oriented syntax can be found in chapter 34 of the manual. To reproduce the bug.

The result, according to the manual on approximately page 754, should be

The code in @FIRfilter/display.m is

And the corresponding code in @polynomial/display.m is

Using the debugger, the result of the call to inputname is "". This is a regression that happened in between 3.2.4 (working) and 3.4.3. Sadly, we do not have regression tests running that can catch this.

Rik <rik5>
Project Administrator

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by oheim (Posted a comment)
  • -unavailable- added by rik5 (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 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 14 Jan 2016 04:37:08 PM UTCrik5StatusNone=>Fixed
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1