Lynxer

Documentation

Types

Every declaration, parameter, assignment, and -> type return annotation is validated against a type name. This page lists the names, what they accept, and how values are converted. For a runnable overview see language.

Scalar and container types

TypeAcceptsNotes
anyanythingno checking
intintegers, or a float with no fractional part2.0 → 2; 1.5 is rejected
floatany numberan int is widened
numint or float
booltrue / falsean integer 1 is not accepted
numBool0 or 1out-of-range values fail
bit0 or 1alias of the numBool range
charone character, or a one-character string"AB" fails with string length 2 is not a char
strtexta number is not accepted
lista list valuesee lists
tuplea tuple valueImmutable, ordered, fixed-length sequence. See lists for details.
sentinela sentinel valuebuilt with sentinel() / sentinel("NAME")
objectan object valuebuilt with object()
codeblocka stored blocksee language
functiona Lynxer function valuecan be stored, returned, passed, and called; see functions
functionAddressa native function addressinteger handle
struct / class / enum namea value of that named typesee the dedicated pages

none is a value, not a declarator type: write any x = none;. It may be used as a return annotation (-> none), where it accepts only the no-value result. See Return annotations.

An ordinary function can introduce an inferred type parameter with type T of value in its parameter list. Each call infers T from value; within a call, later parameters using T, local variables declared as T, and the return annotation can use that type. See function parameters for an example and restrictions.

Fixed-width numeric types

TypeRange
int8-128 .. 127
int16-32768 .. 32767
int32-2147483648 .. 2147483647
int64the full signed 64-bit range
uint8 / byte0 .. 255
uint160 .. 65535
uint320 .. 4294967295
uint64the full unsigned 64-bit range
float32finite values up to about 3.4e38
float64finite values up to about 1.8e308

Fixed-width values are checked at every boundary — declaration, parameter, assignment, and return — and an out-of-range value is a source-located error, for example value 200 is out of range for type 'int8'.

uint64 values above 2^63 - 1 are held in a separate internal representation so the full range survives; 18446744073709551615 prints and round-trips exactly, including through the native-memory writes in builtins.

global setup(){}

func scaled(int16 n) -> int32 {
    return n * 2;
}

global main(){
    numBool enabled = 1;
    byte mask = 255;
    float32 ratio = 0.25;
    char initial = "Z";
    println(scaled(12));   // 24
    println(mask);         // 255
    println(ratio);        // 0.25
    println(initial);      // Z
}

Conversion rules

Return annotations

Use the arrow form:

global f(int x) -> int { return x + 1; }
func label(str name) -> str { return "hi " + name; }