'evalin' weirdness

John W. Eaton jwe at octave.org
Fri Jan 23 09:54:37 CST 2009


On 23-Jan-2009, Søren Hauberg wrote:

| I'm in the process of fixing the bug Ben reported about 'type' in the
| new implementation of the help system. Here, I cannot fix this as I'm
| affected with a bug in 'evalin'. The following function
| 
|   function bla ()
|     name = 'test';
|     evalin ('caller', '1+2')
|     disp (name)
|   endfunction
| 
| Fails with the error 
| 
|   error: `name' undefined near line 4 column 9
| 
| It seems that somehow the 'evalin' call removes the 'name' variable.

I think the problem is that the context is not properly reset from the
caller to the function BLA.  For example, try

  name = "foobar";
  bla

and I think there will be no error but "disp (name)" will show
"foobar" instead of "test".

I'm not yet sure why this is happening, but I'll see if I can fix it.

jwe



More information about the Bug-octave mailing list