Data types

Rant has 10 built-in data types:

Type nameDescriptionPass type
stringSequence of UTF-8 charactersby-value
int64-bit signed integerby-value
float64-bit double-precision floatby-value
boolBoolean valueby-value
listList of valuesby-ref
mapString-keyed collection of valuesby-ref
blockStored blockby-ref
specialHandle to internal runtime data, such as a selectorby-ref
emptyUnit type representing "null" valueby-value

The empty type

To represent the lack of a value, Rant has the empty type, which has only one possible value, represented by the token ~.

<$nothing = ~>    # i.e. <$nothing>
[type:<nothing>]  # empty

Boolean values

The two boolean values are represented by the keywords true and false. These keywords can still be used as fragments when not used alone, as their string representations are simply "true" and "false"; however, if they are passed on their own and need to be strings, you will need to put them in a string literal.

Type inference for expressions

In order to resolve type ambiguities, Rant makes a few basic assumptions:


Any number token without a decimal place becomes an int.

[type:123]  # int


Any number token with a decimal place becomes a float.

[type:123.0]  # float

Top-level fragments or whitespace

Any expression containing top-level text (i.e. not in a collection) evaluates to a string.

Whitespace at the start or end of an expression is ignored.

# Since there are fragments and whitespace, it's a string
[type:99 bottles of beer]  # string

# Since there is whitespace between the numbers, the value is still a string
[type:99 99]  # string

Multiple values in a sequence

If there are multiple values in an expression and at least one is non-empty, it evaluates to a string.

# Even though they are all integer tokens, they are treated as text
[type:10 20 30 40 50]  # string


Expressions containing only empties evaluate to the empty value.

Expressions containing nothing also evaluate to the empty value.

[type:~~]       # empty
[type:~]        # empty
[type:]         # empty