module

Vow::Exportable::Generated

The shared macro engine. Both Vow::Exportable and Vow::Exportable::All route through this by emitting include ::Vow::Exportable::Generated into the user's class, so its included hook fires with @type set to that class. The hook generates, from the class's methods:

  • vow_install(registry) — registers each exported method as a Vow::Procedure whose callback asserts named args, decodes each into its declared type (typed bad_input on failure, honoring defaults), invokes the real method, and JSON-encodes the result. Called for you by Registry#mount.
  • self.vow_descriptors — the static Vow::ProcedureDescriptors for the same methods, readable without an instance, for codegen.
  • self.vow_types — the custom surface types reachable from those signatures, transitively, for codegen.

The set of "exported methods" is mode-dependent, and the mode is read at expansion time (not include time) from @type.ancestors: a class that mixed in Vow::Exportable::All exports every plain public method plus any annotated one; otherwise only the annotated ones. @[Vow::Export(skip:)] excludes a method in either mode.

A macro finished hook validates every exported signature once, for the whole class, regardless of whether anything is ever mounted: each arg must be type-restricted and the return type must be declared — so we never infer or guess, and never emit a descriptor we can't stand behind.