octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #59451] Function handles become invalid if pat


From: Markus Mützel
Subject: [Octave-bug-tracker] [bug #59451] Function handles become invalid if path to function is removed
Date: Fri, 13 Nov 2020 13:46:33 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36 Edg/86.0.622.63

Follow-up Comment #18, bug #59451 (project octave):

I modified the script like so:

dpi = pi;
spi = single (pi);

fprintf ('calling fcn directly\n');

fcn (dpi, dpi)   %% expect "double"
fcn (dpi, spi)   %% expect "single"
fcn (spi, spi)   %% expect "single"
fcn (spi, dpi)   %% expect "single"
fcn ({}, {})     %% expect "none"

fh = @fcn;

cd foo

%% If the following all return "none" then it appears that the
%% function handle is bound to the non-class version of fcn if it is
%% visible in the path.

fprintf ('calling fcn through handle\n');

fh (dpi, dpi)    %% ?
fh (dpi, spi)    %% ?
fh (spi, spi)    %% ?
fh (spi, dpi)    %% ?
fh ({}, {})


With Matlab R2020b:

>> fhtst
calling fcn directly
ans =
    'none'
ans =
    'none'
ans =
    'none'
ans =
    'none'
ans =
    'none'
calling fcn through handle
ans =
    'double'
ans =
    'single'
ans =
    'single'
ans =
    'single'
ans =
    'none'


So the function handle seems to pick up the overloads (even if it was not
"lazy" from the beginning).

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?59451>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]