Timber has a rich expression language and we divide the description in three parts:

Layout-sensitive syntax

Layout of program code is significant in Timber. In many cases, sequences of syntactic elements can be written in tabular form, where each new item starts on a new line and in the same column as the beginning of the previous item. Multi-line items are possible by intending subsequent lines; the end of the sequence is signalled by "outdenting", i.e. indenting less, as in the example

   showSeq xs = concat (map showLine xss)
     where prec = 100
           showLine x = map (showItem 10)
                            (comp prec xx)

   showItem n x = format n ('_' : g x)

The definition of showSeq has a where-clause with a list of two local definitions (defining prec and showLine). The definition of showLine spans two lines, indicated by indentation. The last definition, of showItem, has another indentation level, thus is not part of the where-clause and is hence not local to showSeq. Instead showSeq and showItem form another list of bindings.

It is possible to avoid layout-sensitive syntax by enclosing such sequences in braces and using semi-colon as separator: let {x=1; y=f x 3} in g x y; this is generally not recommended.

Basic forms of expressions

Classes, actions and requests.

Classes in Timber should be thought of as in object-oriented programming: a class is a template, from which we may create several objects. An object encapsulates its own copy of the state variables defined in the class.

Actions and requests are methods that a class may expose to the outside; they may manipulate the local state of objects.

Procedures are subroutines that may be called by actions and requests; they are typically not exposed in interfaces. In contrast to actions and requests, a procedure always reads and writes the local state of its caller, irrespective of the scope in which it was defined.

The syntax of these constructs are similar; they are all built from sequences of statements:

In all cases, statement sequences have layout-sensitive syntax. See the statements page for further descriptions.

  • After and before expressions.

    after expr expr
    before expr expr
    Here the first expr must be a
    Time and the second an action; the latter is given a new baseline (the after case) or deadline (the before case).

    Further forms of expressions

    Here we just summarize for the Haskell programmer expression forms that are available also in Timber and with the same syntax: