bugGNU Octave - Bugs: bug #52851, parse error at command line or in...


bug #52851: parse error at command line or in scripts "duplicate subfunction or nested function name"

Submitted by:  Marshall <marsian>
Submitted on:  Wed 10 Jan 2018 02:41:37 AM UTC  
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Confirmed Assigned to:  None
Originator Name:  Marsian Open/Closed:  Open
Release:  dev Operating System:  Any

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Mon 31 Dec 2018 05:23:33 PM UTC, comment #3:

This is going to require an architectural discussion and perhaps a philosophical one on Octave-Maintainers list about whether to support this. In any case, it won't be fixed for version 5.0 (https://wiki.octave.org/Bug_Fix_List_-_5.0_Release#Bugs_with_severity_.3E.3D_4).

Rik <rik5>
Project Administrator
Fri 12 Jan 2018 12:52:51 AM UTC, comment #2:

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:

is analogous to:

Marshall <marsian>
Thu 11 Jan 2018 11:38:50 PM UTC, comment #1:

Not commenting on whether this behavior should be supported or not, but this is a result of the fix for bug #50014. When the m-file is a function file, not a script, Octave is now correctly making sure that there are no duplicate subfunctions defined in the same file.

Mike Miller <mtmiller>
Project Administrator
Wed 10 Jan 2018 02:41:37 AM UTC, original submission:

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...'".

These all work in 4.2.1 both in windows and linux, but not in either in mxe-octave dev.

Marshall <marsian>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by siko1056 (Updated the item)
  • -email is unavailable- added by marsian (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-12-31 mtmiller Carbon-CopyRemoved 80942 => -
    2018-01-10 siko1056 StatusNone => Confirmed

    Back to the top

    Powered by Savane 3.4