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

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

[Octave-bug-tracker] [bug #53871] In-place increment of a workspace vari


From: Rik
Subject: [Octave-bug-tracker] [bug #53871] In-place increment of a workspace variable with += in a script issues error
Date: Thu, 10 May 2018 11:45:25 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0

Update of bug #53871 (project octave):

                Category:                    None => Interpreter            
                Priority:              5 - Normal => 3 - Low                
              Item Group:                    None => Unexpected Error       
                  Status:                    None => Confirmed              
                 Summary: Increment with += gives error in .m file => In-place
increment of a workspace variable with += in a script issues error

    _______________________________________________________

Follow-up Comment #6:

Confirmed.

jwe's analysis from comment #3 looks accurate.  As a way to test it, I made
count a global variable both at the command line,


global count
count = 0

, and in dummy.m


global count
count += 1


This works because when parsing dummy.m the "global" modifier signals to the
parser that count is a variable and not a function call.

You can trick the parser in to recognizing that count is a variable by using
self-assignemnt in dummy.m.


count = count;
count += 1


That is really weird though.  You are probably better off just using


count = count + 1;


for the time being.

I'm lowering the priority since there are lots of work arounds.


    _______________________________________________________

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]