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: Markus Mützel
Subject: [Octave-bug-tracker] [bug #60237] Differente behaviour in anonymous function handling
Date: Fri, 2 Apr 2021 12:32:59 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36 Edg/89.0.774.63

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

That is a syntax extension that doesn't work in Matlab. I used the following
test case instead:

function r = bug_60237 ()

f = ancall (2);

r = f() + 1;

end


function r = ancall (a)

d = 2;

function c = bm (a)

c = a + d;

end

r = @() bm (a);

end


Results in Matlab R2021a:

>> bug_60237

ans =

     5


Same result with a current tip.

Again: "bm" is a nested function and shares its scope with the containing
function.


    _______________________________________________________

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]