[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: |
Thu, 11 Jan 2018 19:52:51 -0500 (EST) |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0 |
Follow-up Comment #2, bug #52851 (project octave):
I can see the point of not allowing sub-functions or nested functions from
having the same name, which is why I didn't even try to address this bug in
relation to a function file. However, I still have two arguments for why this
is desirable behavior for scripts:
1) If I can manually type or paste something in in at the command line and it
works, I should be able to run that exact same code from running it as a
script to run it all at once. Running a script (F5) is better then highlight
and F9, especially for a large script because of the delay probably due to
printing and executing every line of code individually. This argument supports
allowing syntax like examples 1, 3, and 4 below, but not of 2. (consistency)
2) This is one place where I feel that octave syntax is far better than
Matlab, and it would be disappointing to lose some of its benefit. In these
cases I am basically using the repeated function declarations as multi-line
anonymous functions.
For example:
if true
function computation()
disp('compute 1.1')
disp('compute 1.2')
endfunction
else
function computation()
disp('compute 2.1')
disp('compute 2.2')
endfunction
end
computation()
is analogous to:
if true
computation = @() disp('compute 1');
else
computation = @() disp('compute 2')
end
computation()
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?52851>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/