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 aVow::Procedurewhose callback asserts named args, decodes each into its declared type (typedbad_inputon failure, honoring defaults), invokes the real method, and JSON-encodes the result. Called for you byRegistry#mount.self.vow_descriptors— the staticVow::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.