Logo Xantham

Measures Module

Roles for the integers the decoder passes around. The blob is full of `int`s and `uint32`s that mean entirely different things - a node index, a string index, a byte offset into one section or another, a bitmap, a shift distance - and nothing but the parameter name distinguishes them. These measures make the wrong one a compile error, and erase completely, so the decoder pays nothing for them. The bitwise operators are not defined for measured integers: `mask &&& mask` does not compile, let alone `field &&& mask`. That is the point rather than an obstacle - it forces the operations to be spelled out here, with the roles in the signature, so a mask cannot be used where a shift belongs and masking cannot silently change what a value is.

Types and nested modules

Type/Module Description

Operators

astSlot

A bit position in a node's child mask, i.e. a declared child slot.

bits

A bit count, for shift distances.

byteOffset

A byte offset into the extended-data section, or within one record in it.

mask

A bitmap over some other value's bits. Masks are consumed by masking, never produced by it.

nodeIndex

An index into the blob's node section. `Ast.Root` is one of these.

stringIndex

An index into the string offsets table. Word-indexed, not byte-indexed.

structuredOffset

A byte offset into the structured-data (msgpack) section.

word

A node's raw 32-bit `data` word, before its type bits have been read.

Functions and values

Function or value Description

tag value

Full Usage: tag value

Parameters:
    value : uint32

Returns: uint32<'role>
Modifiers: inline
Type parameters: 'role

Tags a raw `uint32` with the role it plays. Erased; this is a compile-time assertion that the caller knows which of the blob's many integers it is holding.

value : uint32
Returns: uint32<'role>

tagInt value

Full Usage: tagInt value

Parameters:
    value : int

Returns: int<'role>
Modifiers: inline
Type parameters: 'role

Tags a raw `int` with the role it plays.

value : int
Returns: int<'role>

Type something to start searching.