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

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

[Octave-bug-tracker] [bug #47676] Error applying multiplication-assignme


From: John W. Eaton
Subject: [Octave-bug-tracker] [bug #47676] Error applying multiplication-assignment operator to variable defined in script
Date: Wed, 13 Apr 2016 12:08:37 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:44.0) Gecko/20100101 Firefox/44.0 Iceweasel/44.0

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

I mean that currently, unless foo is already defined as a variable, both
Octave and Matlab will parse "foo += bar" as a "command" and then attempt to
find a function foo to call with the arguments '+=' and 'bar' (as strings). 
If we change Octave to recognize += as an operator in this case, then Octave's
behavior will be different from Matlab in this case (and also for "foo
+=bar").

Note that the way "commands" are parsed also depends on spacing.  I thought it
was documented in the Octave manual, but apparently not.  Note that the
following are handled differently (assuming the LHS is not already known to be
a variable:


foo - bar  %% binary subtraction, foo is called with 0 args
foo- bar   %% binary subtraction
foo-bar    %% binary subtraction
foo -bar   %% command, foo is called with '-bar' argument


Yes, this is really unfortunate behavior.

Also my comment #2 should have said "NOT restarting your session", so foo.m is
not parsed again.  The only thing that changes is that a mycmd function is
added to the path.  In a way, this is a good thing, because it would be really
bad for the behavior to also depend on what function names happen to be
available on the path when a function is parsed.


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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