pub enum WasmType {
I32,
Bool,
Ratio,
StringRef,
Commodity,
PairRef(PairElement),
AnyRef,
EntityRef(EntityKind),
Closure(ClosureSigId),
}Variants§
I32
Bool
Boolean: a comparison / predicate / and / or result, or a runtime
#t / #f. Wasm representation is identical to I32 (0 = false,
nonzero = true), so it composes with if / br_if and boxes via
ref.i31 exactly like I32. It is a DISTINCT compile-time type only
so the debug serializer can surface it as Nil / Bool rather than
Number: an I32 is a raw count (tag-count, split-count, …) that
serializes as a number, whereas a Bool is a truth value. Refused by
arithmetic like every non-numeric type.
Ratio
StringRef
Commodity
Commodity-bearing numeric: rational amount + originating commodity
uuid. Distinct from Ratio so the compiler can refuse mixing money
and pure-rational arithmetic at compile time. Wasm representation:
(i64 numer, i64 denom, i64 commodity_hi, i64 commodity_lo).
PairRef(PairElement)
Homogeneous list cell: $pair WasmGC struct with an anyref car
and a nullable $pair cdr. The PairElement records the car’s
type at compile time so CAR/CDR can emit the correct downcast and
CONS refuses heterogeneous mixing. Retires the i32-only $cons —
every runtime list shape in the compiler routes through this type.
AnyRef
Raw anyref car payload extracted from a PairRef(AnyRef) or
produced by a host fn that returns a heterogeneous value
(ADR-0025). Refused by arithmetic / numeric comparison / closure
call / typed pair construction; the script must downcast via
type-test natives (e.g. ok?, err-code) before consuming.
EntityRef(EntityKind)
Typed server-entity reference: a (ref null $<kind>) GC struct
whose field layout matches the nomi_entity! declaration for the
kind. Refused by arithmetic / list-CONS / numeric comparison; the
only legal operations are the entity-specific accessor natives
(account-id, commodity-name, etc.) registered alongside the
struct type.
Closure(ClosureSigId)
First-class closure value: (ref null $closure_<sig>) carrying a
typed funcref + nullable env ref. The ClosureSigId indexes the
per-context registry that owns the wasm types and per-call-site
env-struct layouts. Eligible for FUNCALL / APPLY via call_ref;
refused by arithmetic / numeric comparison / pair construction.