Bbetlang

Types

Every type bet can represent today: scalars, strings, structs, sum types, arrays, SIMD vectors, arena handles, and more.

bet is statically typed with local inference, so lowkey x = 5 figures out int on its own. When you want a specific type, spell it out with an annotation (lowkey x: i32 = ...) and the compiler takes you at your word. tag, crib, and soa are keywords that moonlight here in type position; everything else below is a predeclared type name or constructor.

Casts: expr as T

Conversions are always explicit; bet will never narrow a value behind your back. You ask for the cast, and the compiler picks the right conversion from the operand and target types: integer to integer, integer to float, an f32/f64 resize, or a same-size bit reinterpret.

lowkey small = 300 as u8   // truncates / wraps -> 44
lowkey n = 3.9 as int      // truncates toward zero -> 3

Every type

ref and the tuple type are compiler-produced, meaning you’ll run into them (a holla live binding, or a multi-value return) without ever writing them out as standalone annotations yourself.

scalar
bool≈ 1-bit logical

Boolean value. Literals are the keywords nocap (true) and cap (false).

i8≈ signed, 8-bit

Signed 8-bit integer.

i16≈ signed, 16-bit

Signed 16-bit integer.

i32≈ signed, 32-bit

Signed 32-bit integer.

i64≈ signed, 64-bit

Signed 64-bit integer.

u8≈ unsigned, 8-bit

Unsigned 8-bit integer — also the byte type.

u16≈ unsigned, 16-bit

Unsigned 16-bit integer.

u32≈ unsigned, 32-bit

Unsigned 32-bit integer.

u64≈ unsigned, 64-bit

Unsigned 64-bit integer.

int≈ alias of i64

The default integer (signed, 64-bit).

uint≈ alias of u64

Unsigned 64-bit integer.

f32≈ 32-bit IEEE float

32-bit IEEE floating-point.

f64≈ 64-bit IEEE float

64-bit IEEE floating-point.

float≈ alias of f64

The default float type. Integral values print with a trailing .0.

void≈ unit (alias: nada)

The no-value type: a function that returns nothing has return type void. Also the element type of an untyped bump crib.

nada≈ alias of void

Alias for the unit type void.

string
str≈ UTF-8 string

A UTF-8 string value, a fat { ptr, len } pair; indices are byte offsets. A single-quoted byte literal 'A' has type u8.

struct
drip≈ struct / record

A record type with per-field visibility (flex exported, hush/unmarked private). Structs are values — assignment copies. Supports Go-style methods and generics (drip Pair[T]).

sum type
moods≈ enum / tagged union

A tagged union: a discriminant plus a payload; variants may carry payloads or be nullary. Matched exhaustively with vibe (naw is the wildcard).

array / slice / tuple
T[N]≈ fixed array

A fixed-size, inline array of N elements (e.g. [10, 20, 30] infers [3]int).

[]T≈ slice

A fat { ptr, len } view over a run of T (same layout as str). mem.slab[T](n) yields a zeroed slice; str.bytes(s) yields a []u8.

tuple≈ multi-value

Not spelled as a standalone type; carries a multi-value return as one value, produced and consumed with commas. Compiler-produced.

simd
f32x4≈ <elem>x<N> vector

First-class fixed-width SIMD vectors that lower to real LLVM vector ops. Named <elem>x<N> with N ∈ {2,3,4}: f32x4, f64x2, i32x4, u8x4, … Element-wise + - * / and integer shifts; lane reads .x/.y/.z/.w; methods .dot .sum .min .max .abs .scale .length .norm.

vec2 / vec3 / vec4≈ float aliases

Float SIMD aliases: vec2 = f32x2, vec3 = f32x3, vec4 = f32x4.

soa
soa≈ struct-of-arrays

A keyword layout modifier that transposes a container of a flat drip to struct-of-arrays: soa T[N], soa []T, soa vec[T]. Element access reads the same (ps[i].field); whole-element operations are a compile error.

arena handle
tag T≈ generational handle

An 8-byte generational handle (Tag { slot, generation }) into a typed crib. Plain copyable data; you cannot deref it directly — reach data via holla (checked) or trust (unchecked).

crib T≈ arena handle

A crib (arena) handle used as a parameter or field type, so functions can take the arena they allocate into.

ref T≈ live reference

A resolved, guaranteed-live reference into a crib element. Compiler-produced — what a holla live-arm binding and trust() yield; not spelled yourself.

runtime handle
stash[K, V]≈ hash map

A hash-map handle. Operations: stash.new[K,V](), .put, .peep (returns (V, bool)), .yeet, .gang (count).

vec[T]≈ growable array

A growable array handle (distinct from a fixed [N]T). vec.new[T](), .stack, .pop, .gang, indexing, squad iteration; vec[u8] doubles as a string builder.

rng≈ PRNG handle

An opaque seeded-PRNG handle from math.cook(seed) (xoshiro256**). Methods .roll(), .frac(), .upTo(n). Deterministic across interp and compiled.

function
finna(params) -> ret≈ function value

A first-class function value; functions are passed by name and stored in variables or struct fields (v1's dispatch mechanism — no interfaces/traits yet).

error
yikes≈ error type

The error type for Go-style (value, yikes) returns. yikes.new("msg") constructs one; .tea("context") wraps one; ghosted is the nil error.