Possible closure error
John W. Eaton
jwe at bevo.che.wisc.edu
Fri Aug 22 15:33:56 CDT 2008
On 21-Jan-2008, Neal Groothuis wrote:
| --------
| Bug report for Octave 3.0.0 configured for i686-pc-linux-gnu
|
| Description:
| -----------
|
| If a function f returns a reference to an anonymous function that
| refers to a variable in f, calls to the returned function may
| error out indicating that the referenced variable is undefined.
|
| Repeat-By:
| ---------
| function bar=foo(k)
| bar=@(x) arrayfun(@(y) if (y>k) y-k else 0 endif, x)
| endfunction
| baz=foo(3)
| baz(2)
|
| (Note that the following code works:
| function bar=foo(k)
| bar=@(x) x-k
| endfunction
| baz=foo(3)
| baz(2)
| )
I installed the following change to fix this problem in the current
development sources.
Since the symbol table code has been completely rewritten to handle
class objects, this patch will not apply to the 3.0.x sources, but the
problem should be fixed in the next major relesae of Octave (3.2).
Thanks,
jwe
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: diffs
Url: https://www.cae.wisc.edu/pipermail/bug-octave/attachments/20080822/18953330/attachment-0001.ksh
More information about the Bug-octave
mailing list