bugGNU Octave - Bugs: bug #39168, break command at top-level in...

 
 

bug #39168: break command at top-level in script has no effect on loop in calling context

Submitted by:  Rouhollah <paryshaan>
Submitted on:  Wed 05 Jun 2013 08:42:11 AM UTC  
 
Category: Octave FunctionSeverity: 2 - Minor
Priority: 3 - LowItem Group: Matlab Compatibility
Status: FixedAssigned to: None
Originator Name: Open/Closed: Closed
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.

 

(Jump to the original submission Jump to the original submission)

Thu 17 Nov 2016 07:18:30 PM UTC, comment #6:

Ok, calling this fixed.

Mike Miller <mtmiller>
Project Administrator
Thu 17 Nov 2016 07:16:15 PM UTC, comment #5:

I don't think so.

John W. Eaton <jwe>
Project Administrator
Thu 17 Nov 2016 06:38:24 PM UTC, comment #4:

So is the example posted here not expected to work in a current release of Matlab?

Mike Miller <mtmiller>
Project Administrator
Thu 17 Nov 2016 03:25:54 PM UTC, comment #3:

I believe the following changeset improves compatibility with Matlab

http://hg.savannah.gnu.org/hgweb/octave/rev/9c6661004167

John W. Eaton <jwe>
Project Administrator
Wed 16 Nov 2016 08:20:31 PM UTC, comment #2:

This example still behaves the same way in Octave 4.2 and the development version. Can someone with access to a current version of Matlab confirm that this is a compatibility issue? Does a script file with a "break" command in it break out of a loop in the calling script?

Mike Miller <mtmiller>
Project Administrator
Wed 05 Jun 2013 03:36:20 PM UTC, comment #1:

The word "subroutine" is ambiguous here. We don't use it when talking about Octave. The point is that you're running a script file, not a function file, and script files don't create scopes, so if they have a break command in them, it should refer to the scope of where they were called from.

Jordi GutiƩrrez Hermoso <jordigh>
Project Administrator
Wed 05 Jun 2013 08:42:11 AM UTC, original submission:

when a main file with a loop calls a subroutine with "break" command, the command doesn't affect the loop of main file. It should exit from the loop, but it only exits from the second file.

For example: if we have 2 m files "Main.m" and "Subroutine.m" like these:
Main:

Subroutine:

Now if we run "Main" the result will be:

Now if we replace "break" with "continue" in "Subroutine" and run "Main" again we have:

Rouhollah <paryshaan>

 

(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 jwe (Posted a comment)
  • -unavailable- added by mtmiller (Posted a comment)
  • -unavailable- added by jordigh (Posted a comment)
  • -unavailable- added by paryshaan (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):

     

     

    Follow 10 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 17 Nov 2016 07:18:30 PM UTCmtmillerStatusNeed Info=>Fixed
      Open/ClosedOpen=>Closed
    Wed 16 Nov 2016 08:20:31 PM UTCmtmillerSeverity3 - Normal=>2 - Minor
      Priority5 - Normal=>3 - Low
      StatusConfirmed=>Need Info
      Release3.6.4=>dev
      Summary"break" in script has no effect on loop in main.=>break command at top-level in script has no effect on loop in calling context
    Wed 05 Jun 2013 03:36:20 PM UTCjordighStatusNone=>Confirmed
      Operating SystemMicrosoft Windows=>Any
      Summary"break" in subroutine has no effect on loop in main.=>"break" in script has no effect on loop in main.

    Back to the top


    Powered by Savane 3.1-cleanup1