Data types
Every value in XS has a type; the built-in ones cover the full range from scalars to collections.
Summary
Integers are 64-bit signed and promote automatically to arbitrary-precision bigints on overflow. Floats are IEEE 754 double-precision. Strings accept single or double quotes. Arrays, tuples, maps, ranges, and regexes are all first-class. The type() function returns the lowercase type name at runtime.
Canonical
| Type | Literal | Example |
|---|---|---|
| Integer (i64) | decimal, hex, binary, octal | 42, 0xFF, 0b1010, 0o77 |
| Float (f64) | decimal, scientific | 3.14, 1e10, 2.5e-3 |
| Boolean | true, false | true |
| String | double/single quoted | "hello", 'world' |
| Null | null | null |
| Array | brackets | [1, 2, 3] |
| Tuple | parentheses | (1, "a", true) |
| Map | hash-braces | #{"key": "value"} |
| Range | dots | 0..10, 1..=5 |
| Regex | forward slashes | /[0-9]+/ |
| Function | fn keyword | fn(x) { x + 1 } |
println(type(42)) -- int
println(type(3.14)) -- float
println(type("hi")) -- str
println(type(true)) -- bool
println(type(null)) -- null
println(type([])) -- array
println(type(#{})) -- map
println(type((1, 2))) -- tuple
println(type(0..5)) -- range
println(type(/abc/)) -- re