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

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

[Octave-bug-tracker] [bug #60137] Closures: differences in behavior with


From: John W. Eaton
Subject: [Octave-bug-tracker] [bug #60137] Closures: differences in behavior with MatLAB
Date: Mon, 1 Mar 2021 21:39:10 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0

Update of bug #60137 (project octave):

                  Status:                    None => Confirmed              

    _______________________________________________________

Follow-up Comment #1:

Confirmed.  A simpler example is


function fh = test_nested_func ()
  x = sin (pi);
  y = 13;
  function nested_func ()
    y  %% OK
    x  %% UNDEFINED
  endfunction
  fh = @nested_func;
endfunction


then I see the following:


octave:1> fh = test_nested_func ()
fh = @nested_func
octave:2> fh ()
y = 13
error: 'x' undefined near line 6, column 6
error: called from
    test_nested_func>nested_func at line 6 column 5


It's quite strange that the value of Y is captured, but not X in this
example.

This problem happens with current default, stable, 6.2.0, and 6.1.0.  Since
handles to nested functions were introduced in 6.1.0, I'm not sure this can
really be considered a regression, but it is something that should work.  I'll
look at fixing it for 6.3.0.

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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