See WebL Core Operators lists the operatorsof the WebL core language. To illustrate how operators are overloaded, we use a functional notation even though the operators are written in infix, prefix, or right-bracket fix. For example,
denotes that an infix operator op takes a first operand of x of type T and a second operand y of type S, and returns a value of type U. Unary operators have only a single argument to specify.
Two special operators are not contained in the operator table, since they have special constraints on when they can be used and hence cannot be specified in the syntax just introduced. The two operators are assignment ("=") and field definition (":=").
The left-hand side of an assignment must denote a variable or an object and field name combination. The left-hand side of a field definition must denote an object and field name combination, eg. obj[field] or obj.field. The value of an assignment or field definition is always the right-hand side of the operator. These two operators also differ in another way from the remainder of the operators, in that they have side-effects, namely the setting of the value of a variable or field of an object to the right-hand side of the operator.
|
+(x: int, y: int): int |
|
|
+(x: char, y: string): string |
|
|
-(x: int, y: int): int |
|
|
*(x: int, y: int): real |
|
|
/(x: int, y: int): int |
|
|
C(x: int, y: int): bool |
|
|
Value equality test. See Value Equality |
|
|
Value in-equality test. See Value Equality |
|
|
[](x: list, i: int): any |
List, object, and string indexing1. Elements in a list and string are numbered from 0 to Size-1. |
|
member(x, s: set): bool |
Set, list and object2 membership test. |