[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #54490] Order of evaluation in assignment expr
From: |
anonymous |
Subject: |
[Octave-bug-tracker] [bug #54490] Order of evaluation in assignment expression |
Date: |
Sat, 11 Aug 2018 23:14:21 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Windows NT 5.1; rv:51.0) Gecko/20100101 Firefox/51.0 |
Follow-up Comment #4, bug #54490 (project octave):
As I inspected the source, the parser when parsing the expression:
[x(a)]=y
creates an instance of _tree_multi_assignment_ class and for
x(a)=y
it creates an instance of _tree_simple_assignment_ class.
Now I'm curious to know how does MATLAB evaluate this:
function [x y]=test1()
global k;
k = 1;
x = rand;
y = rand;
end
global k;
k = 2;
a = cell;
[a{1:k}] = test1();
a
and this:
function [x y]=test2()
disp(nargout)
global k;
k = 1;
x = rand;
y = rand;
end
global k;
k = 2;
a = cell;
[a{1:k}] = test2();
a
The problem is that when MATLAB begins to run a function that has multiple
outputs it should know, before entring the function, the number of outputs
requested or *nargout*. I think Octave takes the correct way that first
evaluates the left hand side and then the right hand side.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?54490>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #54490] Order of evaluation in assignment expression, anonymous, 2018/08/11
- [Octave-bug-tracker] [bug #54490] Order of evaluation in assignment expression, Philip Nienhuis, 2018/08/11
- [Octave-bug-tracker] [bug #54490] Order of evaluation in assignment expression, anonymous, 2018/08/11
- [Octave-bug-tracker] [bug #54490] Order of evaluation in assignment expression, Philip Nienhuis, 2018/08/11
- [Octave-bug-tracker] [bug #54490] Order of evaluation in assignment expression, Philip Nienhuis, 2018/08/11
- [Octave-bug-tracker] [bug #54490] Order of evaluation in assignment expression,
anonymous <=
- [Octave-bug-tracker] [bug #54490] Order of evaluation in assignment expression, Philip Nienhuis, 2018/08/12
- [Octave-bug-tracker] [bug #54490] Order of evaluation in assignment expression, Guillaume, 2018/08/13
- [Octave-bug-tracker] [bug #54490] Order of evaluation in assignment expression, John W. Eaton, 2018/08/13
- [Octave-bug-tracker] [bug #54490] Order of evaluation in assignment expression, John W. Eaton, 2018/08/13
- [Octave-bug-tracker] [bug #54490] Order of evaluation in assignment expression, John W. Eaton, 2018/08/14
- [Octave-bug-tracker] [bug #54490] Order of evaluation in assignment expression, Philip Nienhuis, 2018/08/17
- [Octave-bug-tracker] [bug #54490] Order of evaluation in assignment expression, Rik, 2018/08/27