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

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

[Octave-bug-tracker] [bug #47676] Cannot apply computed assignment to a


From: John W. Eaton
Subject: [Octave-bug-tracker] [bug #47676] Cannot apply computed assignment to a variable defined after the code was parsed (e.g., in a script)
Date: Thu, 10 May 2018 15:36:53 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0

Follow-up Comment #21, bug #47676 (project octave):

Looking at

https://www.mathworks.com/help/matlab/matlab_prog/command-vs-function-syntax.html

it appears that Matlab may do different things depending on whether it is
parsing something at the command line or in a function or script, and if it is
parsing a function, it may not look to see whether a symbol already appears to
be a variable.  Is that correct?  That's not the way I thought Matlab's parser
behaved.  Would someone like to try testing that?  For example, does the
following return 0 or does it try to call xyz with the argument '-pi'?  Or
something else?


function r = fun ()
  xyz = pi;
  xyz -pi;
end


And, at the command line, does


xyz = pi
xyz -pi


perform subtraction or attempt a function call?

In any case, back to Mike's question in comment #18: if we use syntax alone to
parse expressions with OP= operators, should we treat them like =, where
spacing isn't significant, or like other operators, where it is?

And, should the behavior really be different at the command line?

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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