bugGNU Octave - Bugs: bug #56883, inputname() is empty when calling...

 
 

bug #56883: inputname() is empty when calling a classdef method by "dot notation"

Submitted by:  Jiawei Wang <jwang>
Submitted on:  Thu 12 Sep 2019 08:56:35 AM UTC  
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Confirmed Assigned to:  None
Originator Name:  Jiawei Wang Open/Closed:  Open
Release:  dev Operating System:  Any

Add a New Comment (Rich Markup)
   

You are not logged in

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

 

Thu 12 Sep 2019 01:56:44 PM UTC, comment #1: 

Thank you for the report.  I can confirm this behavior for the current stable and dev version of Octave.  Interesting is that Matlab R2019a is not able to get the inputname of "pi" at all:

>> obj = some_class();
>> some_method (obj, pi)
[obj]
[]
>> obj.some_method (pi)
[obj]
[]

I modified your method to print both inputnames:

fprintf('[%s]\n', inputname(1));
fprintf('[%s]\n', inputname(2));

Kai Torben Ohlhus <siko1056>
Project Member
Thu 12 Sep 2019 08:56:35 AM UTC, original submission:  

Consider the following class definition

classdef some_class
    methods
        function some_method(obj, x)
            fprintf('[%s]\n', inputname(2));
        end
    end
end

and the commands

obj = some_class();
some_method(obj, pi);
obj.some_method(pi);

gives

[pi]
[]

I think both results should be [pi].

Jiawei Wang <jwang>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by siko1056 (Posted a comment)
  • -email is unavailable- added by jwang (Submitted the item)
  •  

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

    Only project members can vote.

     

     

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-09-12 siko1056 StatusNone => Confirmed
        Release5.1.0 => dev
        Operating SystemMicrosoft Windows => Any
        Summaryinputname() returns empty when called in a "dot style" method => inputname() is empty when calling a classdef method by "dot notation"

    Back to the top


    Powered by Savane 3.5