Simkin supports the following expression types:
Type | Description | Example |
---|---|---|
literal | a literal value of one of the built-in data types | "Simon", 100 |
self | a reference to the object owning the method | anotherObject.register(self) |
identifier | this is the name of a variable or method, see below for scoping rules | MyVariable |
indirection | you can prepend the identifier with @ to provide indirection | @MyVariable |
attribute | this accesses an attribute in another object | Account:Balance |
field | this accesses a field in another object, or a sub-item within a field | Person.Surname |
not | negates an expression | not Overdrawn |
and | logical and | Overdrawn and WithinRedZone |
or | logical or | DepositAccount or CurrentAccount |
equality | equality test | Name="Simon" |
less than | integer less than | a lt b |
greater than | integer greater than | a gt b |
subtract | integer subtract | 12 - 1 |
add | integer addition | 12 + 1 |
minus | integer inversion | - 1 |
times | integer multiplication | 12 * 1 |
divide | integer division | 12 / 1 |
modulus | integer modulus | 12 % 1 |
concatenation | adding two strings together | "First Name " # " Surname" |
subexpression | for grouping expressions and enforcing precedence | (4+1)+5 |
method call | calling a method on an object an using the return value | currentBalance=Person.balance() |
self method call | calling a method on the current object and using the return value | sendMessage(message) |