octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #52292] behavior of "break" changed and is now


From: Hartmut
Subject: [Octave-bug-tracker] [bug #52292] behavior of "break" changed and is now incompatible to Matlab
Date: Thu, 26 Oct 2017 15:45:19 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:56.0) Gecko/20100101 Firefox/56.0

URL:
  <http://savannah.gnu.org/bugs/?52292>

                 Summary: behavior of "break" changed and is now incompatible
to Matlab
                 Project: GNU Octave
            Submitted by: hardy
            Submitted on: Thu 26 Oct 2017 07:45:17 PM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: Any

    _______________________________________________________

Details:

The following example code can be run as a script file (let's say example.m)
in Octave 4.2.1 and in Matlab R2014b without any problem. But in current dev
Octave (e.g. with 209e4f34d243) it throws an error.


1+1
break
2+2


The error message in current dev Octave is:


>> example

parse error near line 2 of file example.m

  break must appear in a loop in the same file as loop command

>>> break
        ^


I understand that the content of this error message is correct. I also know
that the Matlab help does not encourage this usage of the break command, they
say:


break is not defined outside a for or while loop. To exit a function, use
return.


Netherless I would like to have this reverted to the previous behavior (i.e.
no error message) because:
* Matlab throws NO error in this case (tested for R2014b, or have they changed
this in newer versions?)
* I am used to using "break" in this way, to conveniently stop a script
somewhere in the middle. (I think I've seen others comment on this changed
behavior as well.) And I might even like Octave to still support my old habit
as an "Octave only" feature, even if Matlab did not support this any more.

What do people think about this? What is a current Matlab version doing in
this case? Or should I change my old habit and use "return" from now on?




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?52292>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]