x-lang

← Index

x/sys/pact

Deferred cross-module registration: run a pairwise setup once every party has loaded, in any load order.

Modules join as their last load-time act; when-entries fire in registration order.

A when-thunk may reference the waited-on module’s globals: it only runs once they are bound.

Class Pact

(Pact join name value)

Announce NAME as joined, publishing VALUE, and fire every pending when-entry this join completes.

Parameters:

Returns: NIL — Nothing

(Pact when names thunk)

Run THUNK once all NAMES have joined: immediately if they already have, else at the completing join. Fires exactly once; never fires if a name never joins.

Parameters:

Returns: NIL — Nothing

(Pact get name)

The value NAME published on join (the newest, if re-joined).

Parameters:

Returns: ANY — The joined value, or nil if NAME has not joined

(Pact has? name)

Test whether NAME has joined the pact.

Parameters:

Returns: BOOL — True if NAME has joined