bugGNU Octave - Bugs: bug #54887, builtin does not work for m files

 
 

bug #54887: builtin does not work for m files

Submitter:  Ceral Paquet <octavebugs>
Submitted:  Tue 23 Oct 2018 04:08:52 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Invalid / Not an Octave Bug Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 4.4.1 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 26 Oct 2018 01:37:14 AM UTC, comment #3: 

Quoting from the Matlab documentation:


A built-in function is part of the MATLAB executable. MATLAB does not implement these functions in the MATLAB language. Although most built-in functions have a .m file associated with them, this file only supplies documentation for the function.

You can use the syntax which function to check whether a function is built-in.


So, jwe is correct that Octave is implementing Matlab-compatible behavior.  Closing report.

Rik <rik5>
Group administrator
Wed 24 Oct 2018 03:39:28 AM UTC, comment #2: 

Oh that's unfortunate. Yep you're right.

That makes it quite difficult to call the original function. Builtin.m doesn't call m-files and run.m doesn't accept arguments. Eval doesn't accept a path. Hm, stuck!

Ceral Paquet <octavebugs>
Tue 23 Oct 2018 04:34:41 PM UTC, comment #1: 

This is what builtin is supposed to do and in Matlab it is documented to do the same (only allows you to overload functions that are part of the Matlab executable).

John W. Eaton <jwe>
Group administrator
Tue 23 Oct 2018 04:08:52 PM UTC, original submission:  

While writing wrappers to workaround the missing 'like' keyword (bug #50854 hint hint!), I noticed that the builtin function does not work properly when used with an m-file.

To give a simple example, take the version.m function.

1. Edit version.m.
2. Insert a line disp('LOCAL')
3. Save in the current directory.
4. Execute the following:

>> version

LOCAL
ans = 4.4.1

>> builtin('version')

LOCAL
ans = 4.4.1

The last command should call the original version.m in

/usr/local/share/octave/4.4.1/m/miscellaneous/

instead of my local copy in /home/ceral/octave/

The same kind of wrapper when used with the zeros command works properly (i.e. builtin calls the compiled zeros function rather than my zeros.m wrapper).

Ceral Paquet <octavebugs>

 

(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 rik5 (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by octavebugs (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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-10-26 rik5 StatusWorks For Me Invalid / Not an Octave Bug
        Open/ClosedOpen Closed
    2018-10-23 mtmiller CategoryNone Octave Function
        Item GroupNone Matlab Compatibility
        StatusNone Works For Me

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code