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

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

[Octave-bug-tracker] [bug #38236] invoking script in demo block to defin


From: Carlo de Falco
Subject: [Octave-bug-tracker] [bug #38236] invoking script in demo block to define variables causes errors
Date: Thu, 21 Mar 2013 07:27:44 +0000
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:19.0) Gecko/20100101 Firefox/19.0

Follow-up Comment #16, bug #38236 (project octave):

Rik,

The tests I had attached below (which are in the source tree in 
test/bug-38236) are already implemented without calling demo.m

u_vr.m can be further simplified as follows:

+eval+
# u_vr.m

## define and exectute "__demo__" once
eval ("function __demo__ ();  df_vr;  v = vr * 2; endfunction");
__demo__;

## clear definition of "__demo__"
clear __demo__

## define and exectute "__demo__" once more
eval ("function __demo__ ();  df_vr;  v = vr * 2; endfunction");
__demo__;

-eval-


running some more experiments I noted even more oddities:

1) If the code avove is in a script file named u_vr, invoking
the script once gives an error, but all subsequent invocations
of u_vr do not err out:


>> clear all
>> u_vr
error: 'vr' undefined near line 1 column 36
error: called from:
error:   __demo__ at line 1, column 35
error:  
/Users/carlo/Documents/_Programmi/Miei/C/octave/octave/test/bug-38236/u_vr.m
at line 14, column 1
>> u_vr
>> 


2) If I remove the "eval" command in u_vr and just redefine the function
'__demo__' there is never any error:


# u_vr.m
1;

## define and exectute "__demo__" once
function __demo__ ();  df_vr;  v = vr * 2; endfunction
__demo__;

## clear definition of "__demo__"
clear __demo__

## define and exectute "__demo__" once more
function __demo__ ();  df_vr;  v = vr * 2; endfunction
__demo__;



>> clear all
>> u_vr
>> u_vr


3) Now this is the most amazing and unexpected effect I see.
If, rather than running the script u_vr I just copy the commands to the
prompt, I get no error


>> eval ("function __demo__ ();  df_vr;  v = vr * 2; endfunction");
>> __demo__;
>> clear all
>> eval ("function __demo__ ();  df_vr;  v = vr * 2; endfunction");
>> __demo__;
>> 


__BUT__, if I also copy the commented lines to the prompt, I get a DIFFERENT
error:


>> ## define and exectute once
>> eval ("function __demo__ ();  df_vr;  v = vr * 2; endfunction");
>> __demo__;
error: '__demo__' undefined near line 1 column 1


I'll push the simplified version of u_vr.m to mercurial.
c.





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?38236>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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