Vow
Vow — annotate your methods, Vow generates the dispatch glue.
Annotate instance methods with @[Vow::Export], include Vow::Exportable
(or include Vow::Exportable::All to export every public method), and the
compiler generates an install(registry) that registers each as a typed,
JSON-in/JSON-out procedure. Transports (HTTP, CLI, …) sit on
Vow::Registry#dispatch and stay out of the codegen.
class API include Vow::Exportable
@[Vow::Export]
def greet(name : String) : String
"Hello, #{name}!"
end
end
registry = Vow::Registry.new(API.new) registry.dispatch("API.greet", %(["world"])) # => %("Hello, world!")
Constants
Markers framing the manifest JSON on stdout, so vow gen --entry can lift
it out cleanly even if the program writes other things at startup.
The flag that turns any Vow program into a manifest emitter. vow gen --entry compiles the user's annotated program and runs it with this — the
user writes no dump code; the @[Vow::Export] annotations are the input.
Class methods
The manifest for EVERY Vow service in the compiled program, built at the
end of compilation straight from the statically-captured descriptors — no
instances, no registry, no user code. Both mixins route through
Vow::Exportable::Generated, so its includers are exactly the services to
gather (annotated or export-all alike).
Writes the discovered manifest to io, framed by the markers. Raises
Vow::Error when nothing is annotated — Vow never emits an empty client.
Pure and testable: no exit, no ARGV.