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

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

[Octave-bug-tracker] [bug #54052] the global statement clears previously


From: John W. Eaton
Subject: [Octave-bug-tracker] [bug #54052] the global statement clears previously assigned values
Date: Sat, 16 Jun 2018 10:40:06 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0

Update of bug #54052 (project octave):

                  Status:          Ready For Test => In Progress            

    _______________________________________________________

Follow-up Comment #14:

Yes, if there is no global value for x defined, then


x = 12
global x


will make x global and preserve the local value.  But if there is already a
global x, then the same statements will make x global but not change the
global value to match the local value.  I see now that I got the warning
message wrong.  I think we can make this behavior somewhat clearer by issuing
two different warnings:


warning: global value of 'x' initialized to existing local value


for the first case, and


warning: local value of 'x' changed to match existing global value


for the second.

I believe this behavior is compatible with Matlab's current behavior, but it
only issues the one "local value may have changed" warning, which is kind of
weird since it should be possible to warn when that actually does occur
instead of just that it could.

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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