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

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

[Octave-bug-tracker] [bug #39257] handles to nested functions are not ye


From: Alexander Barth
Subject: [Octave-bug-tracker] [bug #39257] handles to nested functions are not yet supported
Date: Wed, 10 Jun 2015 19:49:31 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/38.0

Follow-up Comment #3, bug #39257 (project octave):

I can confirm that the issue is still present in octave 4.0.0.
As a consequence one cannot use nested function to define a closure. The
following code would run in matlab but not in octave:



>> addtwo = test_closure(2)

addtwo = 

    @(a)innerfun(a)

>> addtwo(3)               

ans =

     5


where test_closure.m is defined as:


function f = test_closure(x)

f = @innerfun; % fails in octave
%f = @(a) innerfun(a); % fails too in octave
%f = @(a) a + x; % only this works in octave

function s = innerfun(a)
  s = a + x;
end
end



    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?39257>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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