Rant has 10 built-in data types:
|Type name||Description||Pass type|
|Sequence of UTF-8 characters||by-value|
|64-bit signed integer||by-value|
|64-bit double-precision float||by-value|
|List of values||by-ref|
|String-keyed collection of values||by-ref|
|Handle to internal runtime data, such as a selector||by-ref|
|Unit type representing "null" value||by-value|
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
The two boolean values are represented by the keywords
These keywords can still be used as fragments when not used alone, as their string representations are simply
however, if they are passed on their own and need to be strings, you will need to put them in a string literal.
In order to resolve type ambiguities, Rant makes a few basic assumptions:
Any number token without a decimal place becomes an
[type:123] # int
Any number token with a decimal place becomes a
[type:123.0] # float
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
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