(field pat (? init))
  pat: a pattern
  init: any form (optional)

Defines one or more fields.

The arguments to field are similar to let: the initializer is optional, and (field a b c d) is equivalent to (field a b) followed by (field c d).

pat must introduce at least one name binding. Each such binding is allocated some storage within each object of this class. Name collisions within the same state are forbidden.

Object fields can be read or written using [], just like a table.

When an initializer form is present, it will automatically be executed at the beginning of the state's initializer method.

When two fields in different states share the same unqualified name, and that unqualified name is passed to [] or @, one field will shadow the other:

Name shadowing can be bypassed by referring to a field by its qualified name, StateName:item, rather than its unqualified name, item. Fields defined at the toplevel of a class prefix their qualified name with Main:. Fields defined at the toplevel of a mixin prefix their qualified name with MixinName:.