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

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

[Octave-bug-tracker] [bug #60237] Differente behaviour in anonymous func


From: Denis Sbragion
Subject: [Octave-bug-tracker] [bug #60237] Differente behaviour in anonymous function handling
Date: Wed, 17 Mar 2021 15:01:26 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:85.0) Gecko/20100101 Firefox/85.0

Follow-up Comment #7, bug #60237 (project octave):

Hello Markus,

[comment #6 comment #6:]
...
> I'd guess that `args(0).is_function()` would evaluate to false in the case
where it fails.

didn't try to check the value of '.is_function()', but I think this isn't the
source of the problem. With the callback example the following code fails:


function antest()
        b = 2;
        
        af = (@(a)(dot(a,b)));
        
        callback(af,3)
endfunction


Instead this one works:


function antest()
        b = 2;
        
        af = (@(a)(dot(a,2)));
        
        callback(af,3)
endfunction


In both case an anonymous function is used, so '.is_function()' should always
return the same value. For some reason the context with the b variables get
lost in the feval call when a function is passed.

What's weird is that, if I understand the Octave code correctly, the feval
accepting an octave_value just check that the supplied argument contains a
function and then calls the feval accepting a function using the same
'.function_value()' which fails when called directly in my example. I'm even
considering a MinGW bug at this point.

Bye,

Denis Sbragion

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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