================================================================================ === SECTION: 01_core_syntax.md ================================================================================
Result<T> implicitly
unless extern or entrypoint. Valid signatures:
func:name = ReturnType(ArgType:argName)
pub func:name = ReturnType(ArgType:argName)
async func:name = ReturnType(...)
extern func:name = ReturnType(...) Use
pass(val); or fail(code); to
return. Use ..* for variadics:
func:log = void(string:fmt, ..*string[]:args)
Result. DO NOT use
pass/fail. MUST call exit(N);
pub func:main = int32() or
pub func:main = int32(int32:argc, int8[]->:argv)
pub func:failsafe = int32(tbb32:err)
}, if/while/pick). -
if/else:
if (cond) { } else if (cond2) { } else { } -
while: while (cond) { } -
when/then/end:
when (x > 0) { x-=1; } then { /* completed normally */ } end { /* exited early/break */ }
- loop:
loop(start, limit, step) { print($); /* $ is iterator */ }
- till:
till(limit, step) { print($); } - pick
(match):
pick (val) { (0) { }, label: (1) { fall next_label; }, next_label: (2) { }, (*) { /* default */ } }
- pick guards:
pick (ast) { Macro!(a) where (a > 5) { } }
?: val = fn() ? default;
(returns default if error) - Emphatic Unwrap
?!: val = fn() ?! 5;
(calls failsafe(5) if error) - Null Coalesce
??:
val = ptr ?? fallback; - Ternary
is:
int:x = is (a > b) : a : b; discard(expr); or _~ expr;
================================================================================ === SECTION: 02_type_system.md ================================================================================
int8..int64,
uint8..uint64. (No implicit
casting) - LBIM Integers:
int1024..int4096. Native 16-limb
arrays of 64-bits with 0x8000...0000 ERR
sentinels in the highest limb. - Floats:
flt32, flt64. -
Fixed-Point: fix256 (128-bit
int, 128-bit frac). - Booleans:
bool (true, false). -
Strings: string (UTF-8,
immutable, dynamic). - Exotic:
tbb32 ([-2147483647, +2147483647] with ERR
sentinel), ternary (0t), nonary
(0n), any, void.
int32[]:arr = [1,2,3]; (dynamic).
fixed [3]int32:arr = [1,2,3]; (static). -
Tuples:
(int32, string):t = (1, "a"); struct: for data structures.
struct:Point { int32:x; int32:y; }
enum:Status { OK, ERROR }
enum:Event { Click(int32:x, int32:y), Key(string:code) }
a => int32 or
@cast<int32>(a) - Unchecked
(suppresses warnings):
@cast_unchecked<int32>(a)
Defining traits:
trait:Encodable = {
func:encode = string(Self:self); // required method
func:size_hint = int32(Self:self) { // default method (v0.83.1)
pass(0i32);
};
};
Implementing traits:
impl:Encodable:for:Point = {
func:encode = string(Point:self) {
pass("point");
};
// size_hint uses default — omitted
};
Supertraits (v0.83.1):
trait:Ordered = Equatable & { func:compare = int32(Self:a, Self:b); };
Impls of Ordered must also implement Equatable.
Associated types (v0.83.2):
trait:Iterator = {
Type:Item;
func:next = Item(Self:self);
};
impl:Iterator:for:Range = {
Type:Item = int32;
func:next = int32(Range:self) { pass(0i32); };
};
Inherent impls (v0.83.3): Methods on a
type without a trait.
impl:for:Point = { func:magnitude = flt64(Point:self) { ... }; };
Coherence (v0.83.3): No overlapping impls — error if same trait+type implemented twice.
Object safety (v0.83.3):
dyn Trait requires all methods take
self and none return Self.
Derive macros (v0.83.4):
@derive(ToString, Eq, Hash, Clone, Debug, Ord, Default, PartialOrd)
Blanket impls (v0.83.5): Auto-implement
traits for types satisfying bounds.
impl:Display:for:T:where:ToString = { ... };
Multi-bound dyn (v0.83.5):
dyn Printable + Measurable — fat pointer
satisfying multiple traits.
================================================================================ === SECTION: 03_memory_and_safety.md ================================================================================
MyStruct-> - Raw type pointer:
int32-> Cannot cast integers directly to
pointers via @cast (must use FFI or
int64 logic). dalloc(size)
- Arenas:
arena<T>->:a = alloc(1024i64) => arena<T>->;
- Handles: Handle<T>.
16-byte aligned struct ({ i64, i32 }). Contains
.index (uint64) and .generation
(uint32). Not a bit-packed 64-bit int. Result<T>: Hard errors. 2.
Layer 2: unknown: Soft errors
/ degraded states. 3. Layer 3:
failsafe(): Unrecoverable trap.
exit requires clean
<wildx-states> map; otherwise falls back
to failsafe().
You bypass safety using explicitly marked “Terms of
Service” (TOS) keywords which contain !,
raw, drop, or wild. -
raw: Unwraps Result<T>
bypassing error checking. - drop: Runs
function but discards Result<T>. -
wild / wildx: Blocks for unsafe memory
manipulation and raw pointer arithmetic. - !
operators: ?! (emphatic unwrap,
immediately traps to failsafe()).
================================================================================ === SECTION: 04_concurrency.md ================================================================================
async. -
Await them using await. - Must handle the
implicit Result wrapper of the async function:
raw await func() or
val = await func() ? default; -
await cannot be used inside standard
synchronous functions. atomic<T> is a native LLVM-backed type. -
Initialization:
atomic<int32>:c = atomic_new(0i32); -
Aliasing:
atomic_from_ptr<int32>(addr_int64)
aliases memory as atomic without allocation. -
Operations: .load(),
.store(v), .swap(v),
.fetch_add(v), .fetch_sub(v),
.compare_exchange(exp, des). - Memory
Ordering: Operations strictly enforce Sequential
Consistency (SeqCst). No relaxed orderings permitted in
standard code. spawn or sync keywords. Threading
(mutexes, rwlocks) must be managed via
stdlib/concurrent utilizing OS abstractions.