Problem with recursive function handles with new symbol table code

John W. Eaton jwe at bevo.che.wisc.edu
Wed May 7 13:01:28 CDT 2008


On  7-May-2008, John W. Eaton wrote:

| OK, I see the problem, but I don't think the fix is trivial and I'm
| busy at the moment so it may take a few days for me to find the time
| to fix it properly.

Try the following patch.  I think it will fix the problem you
reported, but I'm still not happy with the way scope (the symbols for
a given function) and context (the variable values visible at a
particular call depth) is handled.  I need to think more about how to
do this in a better way.

 One thing I know that is still broken is

  function f (n)
    if (n == 0)
      f (n + 1)
      x
    else
      evalin ('caller', 'x = 13;');
    end
  end
  f (0)

This should print

  x =  13

but it fails.  It's not really a regression though, because it also
failed in Octave 3.0 (and probably all previous versions of Octave)
though the failure was different.

I think everything necessary to make this work is now present in the
symbol table code and the octave_call_stack class from toplev.h, but I
haven't updated evalin yet.

So, I wouldn't be surprised to find other bugs related to recursion,
scoping, and function handles...

jwe


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: diffs
Url: https://www.cae.wisc.edu/pipermail/bug-octave/attachments/20080507/e8cf4abd/attachment-0001.ksh 


More information about the Bug-octave mailing list