Operator precedence: Difference between revisions
Content added Content deleted
Line 2,183: | Line 2,183: | ||
Smalltalk does not have operators which are built in to the language. |
Smalltalk does not have operators which are built in to the language. |
||
<br>All operations are message sends to a receiver object (aka virtual function calls). |
<br>All operations are message sends to a receiver object (aka virtual function calls). |
||
Messages are one of 3 types: |
<br>Messages are one of 3 types: |
||
<br> <I>unary message</I>: no argument, alphanumeric name (highest precedence; left to right evaluation) |
<br> <I>unary message</I>: no argument, alphanumeric name (highest precedence; left to right evaluation) |
||
<br> <I>binary message</I>: any combination of special characters (left to right evaluation) |
<br> <I>binary message</I>: any combination of special characters (left to right evaluation) |
||
Line 2,194: | Line 2,194: | ||
<br>Keyword examples: |
<br>Keyword examples: |
||
<br><code>. min: max: at: at:put: from:to:do: bitAnd: bitOr:</code> |
<br><code>. min: max: at: at:put: from:to:do: bitAnd: bitOr:</code> |
||
Within unary and binary messages, evaluation is strictly left to right. Keyword messages must be parenthesized. |
|||
No table can be presented here: there are too many such operators, and they can also be freely added by the programmer (i.e. you may define your own "Number fooBar" or "Number +-+-+ arg" messages (if it makes any sense to you). |
No table can be presented here: there are too many such operators, and they can also be freely added by the programmer (i.e. you may define your own "Number fooBar" or "Number +-+-+ arg" messages (if it makes any sense to you). |