Skip to main content

Module class

Module class 

Source
Expand description

Class descriptors.

Every heap object’s header word 0 points at a Class, whose first field is the GC vtable. Classes are created when a program loads and live forever. They are frozen: after register_class returns, nothing in a class changes, so any thread may read them freely.

Modules§

ids

Structs§

Builtins
Class
ClassSpec
Fields of a class under construction. register_class assigns the id and the GC vtable.

Enums§

Capability
Which ownership state new instances start in, and how the type may cross threads.
ObjKind
Physical layout of a class’s instances.

Statics§

BUILTINS

Functions§

class_by_id
class_count
class_id_of
Class id of a value; bigints report the Int class id.
class_of
Returns the class of any value, including immediates.
heap_class⚠
The class of a heap object.
immediate_class
register_class
Registers a class, making it immutable and globally visible. Returns its 'static descriptor.
set_methods
Replaces a class’s method table (builtin classes get their methods when the prelude loads). The previous table is leaked, so concurrent readers stay valid.