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: anonymous
Subject: [Octave-bug-tracker] [bug #60237] Differente behaviour in anonymous function handling
Date: Fri, 2 Apr 2021 11:46:08 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:68.9) Gecko/20100101 Goanna/4.6 Firefox/68.9 Mypal/28.14.2

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

Hello,
I'm not sure ,as I don't have access to MATLAB, but I think the following test
that is contained in the change set should produce error in MATLAB. Because
'@(a) bm (a)' doesn't capture 'd'. When calling 'ancall' it should say that
"error: 'd' is undefined".


function r = bug_60237 ()

  d = 2;

  function c = bm (a)

    c = a + d;

  endfunction;

  r = ancall (@(a) bm (a), 2);

endfunction


function r = ancall (f, a)

  r = f (a) + 1;

endfunction


    _______________________________________________________

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]