# Value types

## Syntax

Built-in types often come equipped with their own syntax for applying operations. For example, numbers can have infix binary operators such as **+**, **–**, etc., and prefix unary operators such as **–** and the **square root** symbol; Booleans have infix binary operators representing **and**, **or**, etc., and the prefix unary operator **not**. Each of these sets of operators has its own natural precedence for bracketing.
Our scheme for operator syntax allows operator signatures to be defined as prefix, infix or postfix using a positional notation. For example:

- the prefix
*unary minus* for **Integer** has the signature
**Integer : Integer;**
- the prefix
*not* for **Boolean** has the signature
**not Boolean : Boolean;**
- the infix
*less-than* has the signature
**Integer<Integer : Boolean;**
- the postfix
*squared* uses postfix dot notation as in
**Integer.squared : Integer.**

Only operators defined using the postfix dot notation may take additional parameters, as in **Rectangle.contains(Point): Boolean**. This notation is the same as that used for object navigation expressions and message-sending.
The following operator precedence rules apply, from highest to lowest, to all expressions (including those involving objects):

- non-alphabetic unary prefix;
- non-alphabetic unary postfix;
- alphabetic unary prefix;
- alphabetic unary postfix (dot notation with no parameters);
- infix binary multiplicative;
- infix binary additive;
- other infix binary;
- dot notation with parameters;
- other non-alphabetic infix;

Parentheses ( ) may be used to override these rules, in the normal way. When operators of the same precedence appear unbracketed together, the left-most takes precedence.

## Boolean

### Literals

**{true, false}**
### Type specification

## Character

### Literals

**{ @a, @b, @c, ..., @A, @B, @C, ...}** : characters are prefixed by @ signs.
### Type specification

The only operation defined on characters is equality: **@a=@a**, etc.

## Symbol

### Literals

**{ %symbol, ... }** : symbols are prefixed by percent signs.
### Type specification

The only operation defined on symbols is equality: **%abc=%abc**, etc.

## Number

### Literals

**{1.0, 1.1, 123456789.987654321, ...}** : arbitrary-precision rational numbers specified using decimal notation.
Note that **{0, 1, 2, ...}** are **Integer** literals, see below: **Integer** is a sub-type of **Number**, so these literals also denote **Number** values.

Note that **Number** values can also be denoted by dividing two **Integer** values, for example **22/7**.

### Type specification

## Integer

### Literals

{...,-2,-1,0,1,2,3...} : the normal integer numerals.
### Type specification

**Integer** is a sub-type of **Number**. This means that an **Integer** value can be used wherever a **Number** value is expected. This has the following implications:

- The set of
**Integer** values is a subset of the **Number** values.
- The
**Number** operations are inherited or overridden by **Integer**.
- Any operation overridden by
**Integer** agrees, in the sense that the result obtained by applying it to **Integer** values is the same result as obtained by applying the overridden version to **Number** values.

## Integer sub-ranges

The syntax of sub-ranges of **Integer** is **lower..upper**, **lower** being the lower bound and **upper** the upper (e.g. **1..10**).

## String

### Literals

**{'hello world', ... }** : strings are contained in single quotes. The empty string is denoted by **''**.
### Type specification

Comments, corrections to
jdaniels@cix.co.uk