bugGNU Octave - Bugs: bug #50539, builtin() is unable to call...

 
 

bug #50539: builtin() is unable to call shadowed core isequaln.m

Submitted by:  Felipe G. Nievinski <fgnievinski>
Submitted on:  Tue 14 Mar 2017 12:54:29 AM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Unexpected Error
Status: Wont FixAssigned to: None
Originator Name: Open/Closed: Closed
Release: 4.2.1Operating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Thu 16 Mar 2017 02:00:38 AM UTC, comment #4:

I agree that WONTFIX is appropriate here given that it's hard to keep track of which functions are compiled and interpreted; it's just bad practice to rely on this level of compatibility.

As for the original need, I guess the best way out would be to rename my wrapper as myisequaln.m, then internally call the implementation included in Octave or Matlab if it's available.

Felipe G. Nievinski <fgnievinski>
Tue 14 Mar 2017 05:33:12 PM UTC, comment #3:

If Octave is behaving like Matlab then there is no bug to fix here.

For the motivating issue for this report, I think there is no easy way short of finding the function yourself. I would first determine whether you are running Octave or Matlab and then find the full path to isequaln.m and use that in the try/catch block. The function hasn't moved around much in Octave so you could get by with a fixed string.

Or you could try something like

and then figure out which version was your replacement and which was the m-file from the core libraries.

Rik <rik5>
Project Administrator
Tue 14 Mar 2017 04:49:34 PM UTC, comment #2:

Indeed, unless things have changed recently, Matlab's "builtin" function will only call those functions that are really built-in to Matlab, not core functions that are implemented as .m files.

This is likely to be a constant source of incompatibility since there is no guarantee that the functions built-in to Matlab will also be built-in to Octave.

I guess this also makes it difficult for TMW to change the implementation of a built-in function to be a .m file instead, since some users may depend on calling certain functions through the "builtin" function.

John W. Eaton <jwe>
Project Administrator
Tue 14 Mar 2017 03:37:38 PM UTC, comment #1:

There might be multiple issues here. I want to clarify the behavior of exist() first. In Octave, "builtin" means a compiled implementation of a function. Therefore,

will return 0 since an m-file is not compiled.

From the help page for builtin (http://www.mathworks.com/help/matlab/ref/builtin.html)

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

If you can check with an m-file that you know to be in the Matlab core libraries (try 'which xxx' and look at the file to see if it is an m-file) and then see what exist returns that would help debug this issue.

Also, take a look at the documentation for builtin. It seems to suggest that builtin only works when the "original" function is a compiled function, not when it is an m-file.

Rik <rik5>
Project Administrator
Tue 14 Mar 2017 12:54:29 AM UTC, original submission:

In trying to support multiple Octave/Matlab versions, I have my own isequaln.m:

function varargout = isequaln (varargin)
try
[varargout{1:nargout}] = builtin ('isequaln', varargin{:});
catch
% ... do something here.
end
end

Octave does acknowledge that isequaln is being shadowed:

warning: function C:\work\misc\fx\mpsim\lib\util\legacy\isequaln.m shadows a core library function

But then it is unable to find it:

>> exist('isequaln', 'builtin')

ans = 0

- Question: are core library functions not considered builtin functions? If so, this would represent a Matlab incompatibility issue.

Thanks.

Felipe G. Nievinski <fgnievinski>

 

(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 jwe (Posted a comment)
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by fgnievinski (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 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 16 Mar 2017 02:51:08 AM UTCrik5StatusNeed Info=>Wont Fix
      Open/ClosedOpen=>Closed
    Tue 14 Mar 2017 03:37:38 PM UTCrik5StatusNone=>Need Info
      Operating SystemMicrosoft Windows=>Any

    Back to the top


    Powered by Savane 3.1-cleanup1