I’d like a little clarification on the precedence of the return
statement, which appears to go against the general precedence
rules.
For example the expression
^ 2 + 3.
returns 5(which is what I want) but shouldn’t it return just 2 since Unary operators
of which ^ is one has higher precedence over + which is Binary?.
There are no “unary operators” in Smalltalk. There are only 3 precedence levels: unary messages (“receiver message”), binary operators (“receiver + argument”), and n-ary keyword messages (“receiver message: argument1”). In all cases the receiver comes first.
So “^” is not an operator, but indicates a return statement. Similarly, in “-4” the “-” is not an operator but part of the number literal.