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: Lachlan Andrew
Subject: [Octave-bug-tracker] [bug #39257] handles to nested functions are not yet supported
Date: Sat, 06 Feb 2016 12:20:53 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0

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

Rik, you wrote in comment #1 that "during the implementation of subfunctions,
there was something really troublesome about handles to nested functions".  Do
you by any chance remember the trouble (from back in 2013)?

When I remove the explicit prohibition, and try the code in comment #3, it
complains that x is undefined.  If that is the problem, I'm interested in
exploring solutions.

That problem only occurs if the return value is a handle to a nested function
that accesses a variable from a higher scope.  That shouldn't affect the
GUIDE-generate code, or code (such as mine) written by tweaking Matlab example
code.

If a return value contains such a handle, one approach may be to copy the
parse tree and replace all references to those variables from a higher scope
by references to local copies of those variables, initialized at the start of
each call to have the value at the time the handle was created.

A complication would be if this function called another nested function which
referred to different variables from the higher scope.

If this issue of using variables after they go out of scope was the problem,
the error could just be replaced by a warning, and people could use the
handles for the cases that do work.

Thoughts?

    _______________________________________________________

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]