-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document precedence #732
Document precedence #732
Conversation
| *15* | Assignment operators | ``=``, ``|=``, ``^=``, ``&=``, ``<<=``, | | ||
| | | ``/=``, ``%=`` | | ||
+------------+-------------------------------------+--------------------------------------------+ | ||
| *16* | Comma operator | ``,`` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no comma operator -- jedi mind trick
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, I'll change that. What's up with https://github.com/ethereum/solidity/blob/develop/libsolidity/parsing/Token.h#L107 though? Why does the comma have an order of precedence?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, ok, we have a comma token (as part of tuples, for example), but not on the level of statements, so you are right. it should stay, sorry for the confusion.
+------------+-------------------------------------+--------------------------------------------+ | ||
| *5* | Addition and subtraction | ``+``, ``-`` | | ||
+------------+-------------------------------------+--------------------------------------------+ | ||
| *6* | Bitwise shift operators | ``<<``, ``>>``, ``>>>`` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove >>>
, it is really not used.
Sorry for the confusion, please re-add the comma operator. |
This reverts commit 1ec74f8.
Done. Can we remove |
+ +-------------------------------------+--------------------------------------------+ | ||
| | Parentheses | ``(<statement>)`` | | ||
+------------+-------------------------------------+--------------------------------------------+ | ||
| *2* | Prefix increment and decrement | ``++``, ``--`` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, will do. Out of curiosity, what does the after
keyword do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it can be used as var deadline = after 2 weeks;
and now deadline
will be current block timestamp + (2 * 7 * 24 * 60 * 60)
.
More information is in #527. |
Can you please specify the operator associativity also? Here: |
@Sword-Smith Could you please add an issue for that? |
There is no documentation on the order of precedence of the various operators. This attempts to resolve this.