[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #35436] Private function strange behaviour
From: |
RPS |
Subject: |
[Octave-bug-tracker] [bug #35436] Private function strange behaviour |
Date: |
Thu, 02 Feb 2012 13:26:10 +0000 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.517.44 Safari/534.7 |
URL:
<http://savannah.gnu.org/bugs/?35436>
Summary: Private function strange behaviour
Project: GNU Octave
Submitted by: ryanst
Submitted on: Thu 02 Feb 2012 01:26:09 PM GMT
Category: Interpreter
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Incorrect Result
Status: None
Assigned to: None
Originator Name: ryanst
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: 3.4.3
Operating System: Microsoft Windows
_______________________________________________________
Details:
Private function behaviour seems strange - the private function does not
always override the built-in function. I've added an example to replicate the
problem:
place the following function (test.m) in the test folder:
function test()
while 1
res=sin(pi)
m=menu('test', 'option1', 'option2')
pause;
end
Then add the following two functions under {working folder}/private:
menu.m
function choice = menu(header, varargin)
varargin
choice = input(strcat(header, ' '))
end
sin.m
function res = sin(angle)
res = 'thundercougarfalconbird';
end
Run 'test'. The output is as follows:
octave:6> test
res = thundercougarfalconbird
varargin =
{
[1,1] = option1
[1,2] = option2
}
test1
choice = 1
m = 1
res = thundercougarfalconbird
test
[ 1] option1
[ 2] option2
pick a number, any number: 1
m = 1
res = thundercougarfalconbird
test
[ 1] option1
[ 2] option2
pick a number, any number:
In short, the private sin.m function always gets used while the menu.m
function only gets used the first time. This occurs in both 3.4.3 under
Windows XP and Linux (Ubuntu 11.10 in this case, the 3.4.3 version I
compiled). This works properly when run in MATLAB (R2011b):
>> test
res =
thundercougarfalconbird
varargin =
'option1' 'option2'
test
choice =
[]
m =
[]
res =
thundercougarfalconbird
varargin =
'option1' 'option2'
test
choice =
[]
m =
[]
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?35436>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #35436] Private function strange behaviour,
RPS <=