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

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

[Octave-bug-tracker] [bug #54698] Precedence of call/indexing operator o


From: Michael Leitner
Subject: [Octave-bug-tracker] [bug #54698] Precedence of call/indexing operator over transpose operator
Date: Tue, 25 Sep 2018 16:34:56 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0

Follow-up Comment #25, bug #54698 (project octave):

I said it already, and I say it again: to me, precedence is about where
parentheses are to be implied, and never about rearranging. Wikipedia
(https://en.wikipedia.org/wiki/Order_of_operations) is with me here, and
seemingly also jwe. 

It seems to me that the only potential issue with unary operators is with "++"
and "--", which can either be prefix or postfix, and where the precedence
table decides which it is for instance here


a=0;
b=0;
a+++b


As an aside, I think that this is a misuse of the precedence table, this is
rather a question of parsing (which unfortunately is not documented at all
yet). But apart from that, for unary operators precendence is never a
question, because it is clear what their argument is, namely the expression to
their left (for postfix) or right (prefix), and they are to be evaluated as
soon as their argument has been evaluated (this is the difference from binary
operators, where you have to decide whether an expression that sits between
two binary operators belongs first to the left or to the right). So if I have
the expression 


A++'


I do not need a precedence table for knowing that this is to be understood as



(A++)'


because the expression to the left of ' is just A++. Whatever the precedence
table, the converse case (apart from it being a syntax error in this specific
case) would be completely counterintuitive -- I would be interested in having
pointed out any reasonable programming language that does such reorderings.



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?54698>

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




reply via email to

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