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

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

[Octave-bug-tracker] [bug #53871] Increment with += gives error in .m fi


From: John W. Eaton
Subject: [Octave-bug-tracker] [bug #53871] Increment with += gives error in .m file
Date: Thu, 10 May 2018 10:57:16 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0

Follow-up Comment #3, bug #53871 (project octave):

Yes, this is confusing, and an unfortunate side effect of trying to provide
both the "+=" operator and also parse "count += 1" in a Matlab-compatible way.
 When the script is parsed, Octave doesn't know that count is a variable, so
that += expression is parsed as "command syntax", so it is treated as if it
were


count ("+=", "1")


Then, when the script is executed in the context where count is defined as a
variable, that indexing operation doesn't make sense.  You see 61 in the error
message because that's the ASCII code for the = character, and I think it is
just complaining about the maximum index that is out of bounds.

I'm not sure whether this would be easy to fix to work in the expected way. 
Maybe we can at least provide a more meaningful error message.





    _______________________________________________________

Reply to this item at:

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

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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