[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #52851] parse error at command line or in scri
From: |
Marshall |
Subject: |
[Octave-bug-tracker] [bug #52851] parse error at command line or in scripts "duplicate subfunction or nested function name" |
Date: |
Tue, 9 Jan 2018 21:41:39 -0500 (EST) |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0 |
URL:
<http://savannah.gnu.org/bugs/?52851>
Summary: parse error at command line or in scripts "duplicate
subfunction or nested function name"
Project: GNU Octave
Submitted by: marsian
Submitted on: Wed 10 Jan 2018 02:41:37 AM UTC
Category: Interpreter
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Regression
Status: None
Assigned to: None
Originator Name: Marsian
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: dev
Operating System: Any
_______________________________________________________
Details:
In running some scripts in dev octave that worked before in 4.2.1, I ran into
a new parse error: "duplicate subfunction or nested function name". I've
reduced my code to a couple examples, with increasing complexity in order to
show both the minimal example of what doesn't work but used to, and to show
closer to my current usage that should still work given any potential fixes to
this problem.
All of these work in 4.2.1, whether copied and pasted directly in the command
line, (or highlight and F9 in a script), or whether they are in a script and
the whole script is run (F5). None of these work in the dev version on F5, but
some work if the selection is executed (F9 or copy/paste).
The a=1 in each is only there in the case it is ran as a script (F5) to
differentiate it from a function (e.g. avoid the "warning: function name ...
does not agree with function filename...'".
a=1;%script identifier
function computation()
disp('compute 1')
endfunction
computation()
function computation()
disp('compute 2')
endfunction
computation()
%doesn't work with either F5 or F9
if true
function computation()
disp('compute 1')
endfunction
computation()
else
function computation()
disp('compute 2')
endfunction
computation()
end
a=1;%script identifier
function caller(fun)
fun()
endfunction
function computation()
disp('compute 1')
endfunction
caller(@computation)
function computation()
disp('compute 2')
endfunction
caller(@computation)
a=1;%script identifier
function caller(fun,num)
persistent funarray
if isempty(fun)
funarray(num).fun();
else
if isempty(funarray)
funarray(1).fun = fun;
else
funarray(num).fun = fun;
end
end
endfunction
function computation()
disp('compute 1')
endfunction
caller(@computation,1)
caller([],1)
function computation()
disp('compute 2')
endfunction
caller(@computation,2)
caller([],2)
caller([],1)
These all work in 4.2.1 both in windows and linux, but not in either in
mxe-octave dev.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?52851>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #52851] parse error at command line or in scripts "duplicate subfunction or nested function name",
Marshall <=