bugGNU Octave - Bugs: bug #53886, Unable to shadow the disp buit-in...

 
 

bug #53886: Unable to shadow the disp buit-in function

Submitter:  Rafael Laboissière <rlaboiss>
Submitted:  Sat 12 May 2018 09:02:59 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Wont Fix Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 4.4.0 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 15 May 2018 09:26:40 AM UTC, comment #2: 

Thanks for the clarification, Mike.

I think we can close this bug report.

Rafael Laboissière <rlaboiss>
Mon 14 May 2018 10:10:11 PM UTC, comment #1: 

The reasoning for this was to make the 'disp' (and 'fdisp' and 'display') functions be installed as dispatch methods on all of the builtin Octave types. That means when you call 'disp' with an argument of type double, Octave finds the 'disp' method for that type instead of a global untyped 'disp' function. Same for all builtin fundamental Octave types.

If you call 'disp' without any arguments, it calls your overloaded 'disp' function.

I have no idea if this is Matlab compatible or not, but this is why the behavior is now different.

Now in Octave 4.4, if you create a class directory '@double', and install your disp.m there, your overloaded 'disp' will be called with arguments of type double. That worked in previous versions of Octave and still works in 4.4.

Mike Miller <mtmiller>
Group Member
Sat 12 May 2018 09:02:59 PM UTC, original submission:  

In Octave 4.2.1, I could shadow the disp function:


$ octave-cli --version | grep ^GNU
GNU Octave, version 4.2.1
$ octave-cli -q
octave:1> function disp (varargin)
printf ("New disp function\n")
endfunction
octave:2> disp (1)
New disp function


However, it does not work in 4.4.0:


$ octave-cli --version | grep ^GNU
GNU Octave, version 4.4.0
$ octave-cli -q
octave:1> function disp (varargin)
printf ("New disp function\n")
endfunction
octave:2> disp (1)
 1


Is this normal or is this a regression?

Rafael Laboissière <rlaboiss>

 

(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 mtmiller (Posted a comment)
  • -email is unavailable- added by rlaboiss (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-05-15 mtmiller StatusNone Wont Fix
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code