Types

Types in the Technique language as used in procedure signatures

Types in Technique have two layers: genus, which are the input and output to procedures, and forma, which are the names given to the basic type elements themselves.

Forma

A forma is the basic type element in Technique. A valid forma must:

  • begin with an uppercase letter [A-Z]; then can be followed by

  • any number of additional uppercase letters, lowercase letters, or digits [A-Za-z0-9]*.

Thus A, Arthur, and TheLateArthurDent are all valid forma names, whereas lunchTime and Heart_Of_Gold are not.

Forma names cannot contain dashes, underscores, spaces, or other punctuation.

Genus

Genus are the full types used in procedure signatures. Some genus are simple; they are just the forma themselves. Other types are compound, being lists (arrays of a single forma) or tuples (sets of forma of different types).

Simple

A simple genus is just a forma name standing on its own, as in Encyclopedia.

List

If the input or output of a procedure is a list of items, that can be indicated using [ and ] brackets, for example [BabelFish].

Tuple

If the domain or range is a set of disparate items, they can be expressed by enclosing the list of forma in ( and ) parentheses, for example (HyperDrive, InfiniteImprobabilityDrive).

Tuples can also be written "naked" without parentheses, as a comma-separated list of forma. Semantically these are the same:

making_tea : Leaves, Water -> Tea
making_tea : (Leaves, Water) -> Tea

Unit

There is also the unit genus, (), which is used to signify that something doesn't have an input type or result value, per se.

Examples

These examples show complete procedure declarations with signatures using different genus forms:

poetry_reading : Vogon -> BadPoetry
preparations : (Towel, SubEthaSignalingDevice, Guide) -> HitchHiker
scale_problem : [AlienFleet] -> DinnerForDog