[Top][All Lists]

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

Re: Error with test script

From: Daniel J Sebald
Subject: Re: Error with test script
Date: Sat, 30 Aug 2014 22:16:35 -0500
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20111108 Fedora/3.1.16-1.fc14 Thunderbird/3.1.16

On 08/30/2014 10:06 PM, Daniel J Sebald wrote:

Yes, but that does currently work. The test script in this case is
defining global functions because the contents of the file are being
treated as command-line script statements. Hence, following the
execution of those scripts the functions will be resident in Octave (not
local to some function file). I.e.,

# test script


function say_hello
fprintf('Hello !\n');

octave-cli:10> testscript
octave-cli:11> say_hello
Hello !

Hmm, here's one thing to think about with the above result. I will repeat the process above and then ask for "say_hello":

octave-cli:1> testscript
octave-cli:2> say_hello
Hello !
octave-cli:3> type say_hello
error: type: 'say_hello' undefined
octave-cli:3> say_hello
Hello !

Technically, that error message is bogus because 'say_hello' is defined, as evidenced by its usage. The parser probably doesn't keep the original ASCII definition of the function. (It certainly shouldn't keep a filename, line number and print what is there because the user could modify the file without it being reloaded...suppose the same could be done with regular function files too, but at least there if one runs the function again it reflects whatever is in the file.) If the original ASCII isn't retained, perhaps Octave should at least print something like:

octave-cli:5> type say_hello
say_hello is a global function

similar to what it does for built-in functions.


reply via email to

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