[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: |
Tue, 12 Apr 2016 17:21:17 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:44.0) Gecko/20100101 Firefox/44.0 Iceweasel/44.0 |
Follow-up Comment #2, bug #47676 (project octave):
The problem is that the parser is interpreting the expression as a command,
equivalent to
Csb ('*=', 'fact');
You may have already discovered that if you evaluate example_1 separately
before example_0 or if you replace the call to example_1 with the contents of
that file, then you will not see the error. That's because a script file is
parsed completely and then executed. So when parsing example_0 by itself,
Octave doesn't know that Csb is a variable so it assumes it can be called as a
function.
I suppose we can add a special case for OP= operators so that they may be
parsed as expressions even if the LHS is not yet defined as a variable.
However, this introduces a compatibility issue because then things like
foo += bar
will be handled differently in Matlab.
As I recall, checking to see if the symbol on the LHS is a function when
parsing the expression is not the solution because the following is supposed
to work:
Define in a file with mycmd undefined:
function foo (call_command)
if (call_command)
mycmd +arg1
end
end
Then call it:
foo (0) %% foo is parsed and there is no error for mycmd being undefined.
foo (1) %% error for mycmd undefined
Now define
function mycmd (varargin)
varargin
end
somewhere on the path (restarting your session) and call foo (1) again and it
should display the argument to mycmd as a string.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?47676>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #47676] Error applying multiplication-assignment operator to variable defined in script, Carlo de Falco, 2016/04/12
- [Octave-bug-tracker] [bug #47676] Error applying multiplication-assignment operator to variable defined in script, Carlo de Falco, 2016/04/12
- [Octave-bug-tracker] [bug #47676] Error applying multiplication-assignment operator to variable defined in script,
John W. Eaton <=
- [Octave-bug-tracker] [bug #47676] Error applying multiplication-assignment operator to variable defined in script, Carlo de Falco, 2016/04/13
- [Octave-bug-tracker] [bug #47676] Error applying multiplication-assignment operator to variable defined in script, John W. Eaton, 2016/04/13
- [Octave-bug-tracker] [bug #47676] Error applying multiplication-assignment operator to variable defined in script, Lachlan Andrew, 2016/04/13
- [Octave-bug-tracker] [bug #47676] Error applying multiplication-assignment operator to variable defined in script, Lachlan Andrew, 2016/04/13
- [Octave-bug-tracker] [bug #47676] Error applying multiplication-assignment operator to variable defined in script, Carlo de Falco, 2016/04/14
- [Octave-bug-tracker] [bug #47676] Error applying multiplication-assignment operator to variable defined in script, John W. Eaton, 2016/04/14
- [Octave-bug-tracker] [bug #47676] Error applying multiplication-assignment operator to variable defined in script, John W. Eaton, 2016/04/14
- [Octave-bug-tracker] [bug #47676] Error applying multiplication-assignment operator to variable defined in script, Carlo de Falco, 2016/04/14
- [Octave-bug-tracker] [bug #47676] Error applying multiplication-assignment operator to variable defined in script, Carlo de Falco, 2016/04/14