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

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

[Octave-bug-tracker] [bug #57941] Handle to a nested function with more


From: John W. Eaton
Subject: [Octave-bug-tracker] [bug #57941] Handle to a nested function with more than one input does not work
Date: Mon, 2 Mar 2020 15:04:54 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0

Follow-up Comment #2, bug #57941 (project octave):

I see the problem now.  The context for closures is not being stored correctly
unless the function handle/closure is returned from the function where it is
created.  So if you write


function [fh1, fh2] = test_hnf (A)
  fh1 = @nested1;
  function z = nested1 (x)
    z = A * x;
  end
  fh2 = @nested2;
  function z = nested2 (x,y)
    z = A * x .* y;
  end
end


and then use it as


[fh1, fh2] = test_hnf (1);
quad (fh1, 0, 1)
quad2d (fh2, 0, 1, 0, 1)


it will work as expected.

I'm working on a fix.

Thanks for reporting this problem.

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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