Skip to content

Data types

Peter Johnson edited this page Feb 15, 2023 · 22 revisions

Data Types

⚠️⚠️ THIS WIKI IS BEING USED TO JOT DOWN IDEAS AT PRESENT. DON'T ASSUME ANYTHING IS FIXED. ⚠️⚠️

All placeholders, variables, commands and filters return data of a specific type. Each parameter passed to a command or filter has a data type.

The supported types are given in the following table. Each type has a default string representation and exposes a constructor that can be called using the @construct command.

All data types are immutable.

Types not yet implemented are marked with a ⛔ symbol.

Type Description Default string Literal Value♤ Truthiness Constructor Parameters☆
Text Plain text strings The text itself Default string as double quoted, escaped string All non-empty text is truthy (1) String literal. (2) Instance of any data type: the default string is copied.
Int 32 bit integer The integer as a base 10 string Default string All non-zero integers are truthy. Integer literal.
Float Floating point number The floating point value rendered to full precision. Very large or small values may use scientific notation. Default string floats that do not test equal to zero are truthy (1) Floating point literal. (2) Integer literal or Int instance.
Boolean Boolean value: values are specified using commands @true and @false "1" for true and "0" for false Default string @true is truthy! (1) @true, (2) @false (3) Instance of any data type: data type's truthiness is used.
DateTime Representation of a date and time The ISO standard date string Default string Always truthy (1) Integer literal or Int object parameters representing, in order, Year, Month, Day, Hour(⊙), Minute(⊙), Second(⊙), Millisecond(⊙). Parameters marked ⊙ are optional and default to 0. (2) string literal or Text object containing valid ISO 8601 date.
File Represents a file in the file system Full path to the file Default string as double quoted, escaped string Always truthy (1) String literal or Text object containing full or relative path to the file. (2) Directory object specifying file's directory, followed by string literal or Text object containing file name. 🗒 Either \ or / can be used as path separators: the correct separator for the OS will be substituted automatically.
Directory Represents a directory in the file system Full path to the directory Default string as double quoted, escaped string Always truthy String literal or Text object containing full or relative directory path. 🗒 Either \ or / can be used as path separators: the correct separator for the OS will be substituted automatically.
URL Represents a URL Complete URL Default string as double quoted, escaped string Always truthy String literal or Text object containing complete URL. 🗒 Any illegal characters in the parameter will be correctly URL encoded.
Array Array of values of a any type. Null elements represent unset values. 🗒 Although elements can have type OS, there is no point since all OS values are the same. Concatenation, comma separated, of the default text values of the array elements, surrounded by square brackets Default string Truthy iff at least one element is truthy. A parameter, of Any type, for each array element.
OS Object describing the underlying operating system OS version none Always truthy None.
Any Wraps any of the other data types. The default string of the wrapped data type. As wrapped type Truthy iff the wrapped data type is truthy An instance of data type to be wrapped.
Null A null object. Has no value or attributes. Empty string. none Always falsey None.

♤ Literal value is the string representation of the value used for that type when writing out an Array default string.

☆ In addition to the constructor parameters listed in the table above, all data types have a copy constructor that takes an instance of the data type and creates a copy of it.

⚠️ The OS and Null data types are singletons, i.e. only one instance of each object exists. The first time their constructor are called the singleton object is constructed. Any subsequent calls to the constructors simply returns the existing instance.

🗒️ The pseudo type Number is used in the documentation. It is used to mean either an Int or a Float.

A placeholder itself has the type of the output of the last filter, or of the source if there are no filters, or Null if the ; output suppression operator was used. When a top level placeholder is rendered the data it returns is converted to text using the data type's default string representation.

Variables take the type of the value assigned to them.

The return type of @ commands varies according to the command. See the command reference for details.

The input and output types of filters depend on the filter. See the filter reference for details.

Various cast filters are provided for converting from some types to others.

Clone this wiki locally