Expand description
Function registry: known function signatures for DSL validation.
Each registered function declares its name, category, expected wire inputs, constant parameters, output count, and variadic behavior. The compiler uses this to validate calls at parse time and to generically dispatch variadic functions.
Categories are a type-safe enum — every function must declare one.
Categories group the registry for listings (by_category). The
stdlib files carry a // @category: Name line for readers;
FuncCategory::parse maps that text but no compile path consumes
it.
Signatures are owned by their respective node modules. This file defines the shared types and the collector function.
Structs§
- Factory
Registration - A host’s own
NodeFactory, linked into the registry. - FuncSig
- Description of a registered function’s signature.
- Node
Registration - A node module’s registration: signatures + builder.
- Overload
- A function name that stands for one node per argument type, as
vec_dotstands forvec_dot_f32andvec_dot_f64(polydat_grammar.md §18.1,T-Call-OverloadResolve). - Overload
Form - One form of an
Overload: the registered function a call builds when its wires have these types. Built withOverloadForm::new. - Param
Spec - Describes one parameter in a function’s call signature.
Enums§
- Arity
- Arity specification for a function signature.
- Compile
Level - The maximum compilation level a node supports.
- Default
Resolver - Auto-resolver kind attached to handle-taking functions. Tells the binding compiler which resolver to splice in when a string source is wired to a handle input port.
- Func
Category - Functional category for a Polydat node function.
- Output
Type - Output-type contract for a registered function.
Functions§
- by_
category - Return functions grouped by category in display order.
- factories
- Every factory linked into the registry: each node module’s
NodeRegistration, then each hostFactoryRegistration. A function name belongs to the first factory whose signatures list it. - lookup
- The signature of what a program calls by
name: the registered functionname, or, for anOverloadsuch asvec_dot, its first form’s (Overload::signature), whose parameters every form shares.Nonemeans no call tonamecan build. For an overload the signature’snameis the form’s, such asvec_dot_f32;resolve_callnames the form a call with given wire types builds, andlookup_registeredanswers only for registered functions. Every factory is'static, so its signatures are too, and no allocation is needed. - lookup_
registered - Find a registered function by its exact name: the signature of the
factory that builds it. Unlike
lookup, it answersNonefor an overloaded name, which no factory builds itself. - overload
- The overloaded name
name, if it is one. - overloads
- Every overloaded name linked into the registry.
- overloads_
by_ category - Every overloaded name, grouped by its
Overload::categoryin display order and sorted by name within a category: the namesby_categoryleaves out, since it lists registered functions. A listing of what a program can call shows both. - registry
- Return the full registry of known functions: the signatures of every
linked factory (
factories). - resolve_
call - The function a call to
namewith wires ofwire_typesbuilds: the resolved form whennameis anOverload,nameitself otherwise. - suggest_
function - Find the closest function name to a misspelling, among the
registered functions and the
Overloadnames. - unlisted_
overloads - Every overload whose first form names no registered function,
sorted by name: a registration error, such as a misspelled form or
a form whose module is not linked.
lookupanswersNonefor these names andoverloads_by_categorylists them underFuncCategory::Uncategorised, so a host checks that this is empty, in a test or at startup, to find its own broken registrations.
Type Aliases§
- Node
Build Fn - Builder for a node module:
(build context, name, wires, resolved wire port types, const args) -> Some(Ok(node)) / Some(Err(msg)), orNonewhen the name isn’t handled by this module. The build context carries the bindings under construction and the program tree’s resource scope (crate::dsl::factory::BuildContext).