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: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Regression
Status: ConfirmedAssigned to: None
Originator Name: MarsianOpen/Closed: Open
Release: devOperating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

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 File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

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

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follows 1 latest change.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 10 Jan 2018 01:06:00 PM UTCsiko1056StatusNone=>Confirmed

    Back to the top


    Powered by Savane 3.1-cleanup1