[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #54698] Precedence of call/indexing operator o
From: |
John W. Eaton |
Subject: |
[Octave-bug-tracker] [bug #54698] Precedence of call/indexing operator over transpose operator |
Date: |
Tue, 25 Sep 2018 16:07:53 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0 |
Follow-up Comment #23, bug #54698 (project octave):
Here is the precedence table for Matlab operators, at least as documented. If
actual behavior is shown to be different, then that's a separate issue.
Either way, we should aim to be compatible with Matlab, and the documentation
should match the code.
https://www.mathworks.com/help/matlab/matlab_prog/operator-precedence.html
For our discussion, let's begin by ignoring operators that appear in Octave
but not in Matlab.
Some things to note:
* '=' is not in the list for Matlab, but then assignment is a statement in
Matlab, not an expression, so an assignment doesn't produce a result and
can't appear as part of another expression.
* () is listed as having highest precedence and higher than transpose. Does
Matlab reorder expressions of the form x'(i) to be x(i)' instead? No, but
then indexing is not allowed to apply to temporary results either.
* {} and . are not explicitly listed. Is that just an accidental omission?
* WTF are these operators (#3 in the list)?
Power with unary minus (.^-), unary plus (.^+), or logical negation (.^~) as
well as matrix power with unary minus (^-), unary plus (^+), or logical
negation (^~).
Are they included simply to work around otherwise troublesome precedence
rules? Can these operators be overloaded (for example, in a classdef class)?
I find the whole idea of rearranging expressions like x'(i) a bit weird.
I don't think we can have operator precedence that differs from Matlab. Does
that mean we should not allow indexing of temporary expressions unless they
are written as "f(args)(i)" or "(x')(i)" or similar? Completely disallowing
indexing of temporary expressions will likely be quite unpopular.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?54698>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #54698] Precedence of call/indexing operator over transpose operator, (continued)
- [Octave-bug-tracker] [bug #54698] Precedence of call/indexing operator over transpose operator, anonymous, 2018/09/24
- [Octave-bug-tracker] [bug #54698] Precedence of call/indexing operator over transpose operator, Michael Leitner, 2018/09/24
- [Octave-bug-tracker] [bug #54698] Precedence of call/indexing operator over transpose operator, anonymous, 2018/09/24
- [Octave-bug-tracker] [bug #54698] Precedence of call/indexing operator over transpose operator, Michael Leitner, 2018/09/24
- [Octave-bug-tracker] [bug #54698] Precedence of call/indexing operator over transpose operator, anonymous, 2018/09/24
- [Octave-bug-tracker] [bug #54698] Precedence of call/indexing operator over transpose operator, anonymous, 2018/09/25
- [Octave-bug-tracker] [bug #54698] Precedence of call/indexing operator over transpose operator, Mike Miller, 2018/09/25
- [Octave-bug-tracker] [bug #54698] Precedence of call/indexing operator over transpose operator, anonymous, 2018/09/25
- [Octave-bug-tracker] [bug #54698] Precedence of call/indexing operator over transpose operator, John W. Eaton, 2018/09/25
- [Octave-bug-tracker] [bug #54698] Precedence of call/indexing operator over transpose operator, Mike Miller, 2018/09/25
- [Octave-bug-tracker] [bug #54698] Precedence of call/indexing operator over transpose operator,
John W. Eaton <=
- [Octave-bug-tracker] [bug #54698] Precedence of call/indexing operator over transpose operator, John W. Eaton, 2018/09/25
- [Octave-bug-tracker] [bug #54698] Precedence of call/indexing operator over transpose operator, Michael Leitner, 2018/09/25
- [Octave-bug-tracker] [bug #54698] Precedence of call/indexing operator over transpose operator, anonymous, 2018/09/25
- [Octave-bug-tracker] [bug #54698] Precedence of call/indexing operator over transpose operator, anonymous, 2018/09/26
- [Octave-bug-tracker] [bug #54698] Precedence of call/indexing operator over transpose operator, anonymous, 2018/09/26
- [Octave-bug-tracker] [bug #54698] Precedence of call/indexing operator over transpose operator, anonymous, 2018/09/27