octave-maintainers
[Top][All Lists]
Advanced

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

Re: Octave becoming too MATLAB compatible ?


From: Julien Bect
Subject: Re: Octave becoming too MATLAB compatible ?
Date: Sat, 30 Aug 2014 08:57:40 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.0

Le 29/08/2014 22:21, Ulf Griesmann a écrit :
# test script
say_hello;

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

I don't know if it was working before, but I can confirm that I get the same result in 3.9.0+ (gui-release branch).

On the other hand, changing the script a little bit:

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

say_hello;
--------------------

I get the following output:

--------------------
warning: function name 'say_hello' does not agree with function file name '/home/bect/Sandbox/testscript1.m'
Hello !
--------------------

which is weird I think, because the m-file seems to be recongnized as a function m-file, but still the "say_hello" statement at the end is executed as in a script.

Finally, I have also tried to redefine the function inside the script:

--------------------
disp ("Prevents Octave from thinking it's a function file");

function say_hello
    disp ("Hello !");
endfunction

say_hello;

function say_hello
    disp ("Helloooo !");
endfunction

say_hello;
--------------------

and it gives me:

--------------------
Prevents Octave from thinking it's a function file
Hello !
Helloooo !
--------------------

It is thus possible to redefine a function inside a script m-file which makes my opinion rather natural the error that you get it the first example.

I have no idea if all of this is intended or if a bug report must be created.

@++
Julien




reply via email to

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