octave-maintainers
[Top][All Lists]
Advanced

[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 21:42:39 -0500
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111108 Fedora/3.1.16-1.fc14 Thunderbird/3.1.16

On 08/30/2014 09:23 PM, Rik wrote:
On 08/29/2014 11:58 PM, address@hidden wrote:
Subject:
Octave becoming too MATLAB compatible ?
From:
Ulf Griesmann <address@hidden>
Date:
08/29/2014 01:21 PM

To:
address@hidden

List-Post:
<mailto:address@hidden>
Content-Transfer-Encoding:
8bit
Precedence:
list
MIME-Version:
1.0
Message-ID:
<address@hidden>
Content-Type:
text/html; charset=utf-8
Message:
2



I am sure the following script used to work in Octave:

-----------------------
# test script
say_hello;

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

Now I get the following error in both 3.8.2 and the development version:

octave:1> testscript
error: 'say_hello' undefined near line 5 column 1
error: called from:
error:   /home/ulfg/Octave/testscript.m at line 5, column 1
octave:1>

I don't know if this is a bug or intentional.

I don't think this was ever legal in Octave.  I just tested with
versions 3.2.4, 3.4.3, 3.6.4, 3.8.0 and they all give the same error as
with 3.8.2.

This works (without complaint):

# test script
function testscript
    say_hello;
endfunction

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


And this works (with complaint):

# test script
function say_hello
    fprintf('Hello !\n');
endfunction

say_hello;


The file is being parsed from top to bottom, apparently stopping when it finds an unresolved function name. So, by that logic, the following should work:

# test script
function testscript
    if (0)
        say_hello;
    endif
endfunction

say_hello;

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

It parses without error, but doesn't produce an output. What one can do if they just try. :-)

Dan



reply via email to

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