welder 0.1.0
Bindings for annotated C++ types, from C++26 reflection
Loading...
Searching...
No Matches
welder::resolution Concept Reference

The contract a resolution — the carriage's which-participates policy — must satisfy to be injected as welder::carriages::basic_carriage's Resolution argument. More...

#include <welder/concepts.hpp>

Concept definition

template<class R>
concept resolution =
requires(std::meta::info e, lang L, policy_kind pol, std::meta::info into) {
{ R::participates(e, L) } -> std::convertible_to<bool>;
{ R::is_native_base(e, L, into) } -> std::convertible_to<bool>;
{ R::member_participates(e, L, pol, into) } -> std::convertible_to<bool>;
{ R::class_member_participates(e, L, pol, into) } -> std::convertible_to<bool>;
{ R::namespace_participates(e, L, pol, into) } -> std::convertible_to<bool>;
{ R::counts_as_registered(e, L) } -> std::convertible_to<bool>;
} &&
requires {
{ R::template native_bases<^^detail::any_type, lang{}>() }
-> std::ranges::range;
requires std::same_as<
std::ranges::range_value_t<
decltype(R::template native_bases<^^detail::any_type, lang{}>())>,
std::meta::info>;
}
The contract a resolution — the carriage's which-participates policy — must satisfy to be injected as...
Definition concepts.hpp:337
policy_kind
How greedily a type's members are reflected for binding.
lang
The target languages welder ships rods for — but not the whole value space.
Definition lang.hpp:42
A placeholder class type for shape-probing a member template inside a concept.
Definition concepts.hpp:51

Detailed Description

The contract a resolution — the carriage's which-participates policy — must satisfy to be injected as welder::carriages::basic_carriage's Resolution argument.

A carriage separates three concerns: which entities participate (the reading of welder's markers — the resolution's job), how they are emitted (the welder::rod), and whether they are representable (the bindability gate, shared). A resolution R is a stateless struct of static consteval predicates the carriage consults as it walks a reflected type or namespace. Two ship — marker_resolution (honor weld/policy/marks — the default welder::stitch_welding_carriage) and greedy_resolution (ignore the markers, bind an unmarked library greedily — welder::tack_welding_carriage) — and a user may inject a bespoke one.

Predicates** (each static consteval, mirroring the carriage's call sites). Every per-member predicate takes a trailing std::meta::info bound_into — the entity whose binding receives the decision's subject — as bespoke-rule context: the welded type for class members (held fixed through the base-flattening recursion, so it differs from parent_of(mem) exactly when a non-welded base's member is flattened onto a derived binding), the swept namespace for namespace members, the parent namespace for a nested namespace, the type whose direct base list is being walked for is_native_base. The shipped resolutions ignore it.

static consteval bool participates(std::meta::info entity, lang L);
// a leaf type / function / variable participates for language L. No
// bound_into: reached only from the manual weld_type/weld_function/
// weld_variable entry points, where no reflected context exists.
static consteval bool is_native_base(std::meta::info base, lang L,
std::meta::info bound_into);
// base binds separately (as a base of the class handle) vs. being flattened in
static consteval bool member_participates(std::meta::info mem, lang L, policy_kind pol,
std::meta::info bound_into);
// a namespace member participates under its enclosing scope's policy
static consteval bool class_member_participates(std::meta::info mem, lang L, policy_kind pol,
std::meta::info bound_into);
// a CLASS member — field / method / operator / constructor (and, loosely,
// an enumerator) — participates. Resolved per overload/constructor, so a
// mark (or a bespoke signature-level rule) prunes exactly one; the
// carriage computes each overload GROUP from this predicate, so what a
// rod registers is exactly what the resolution admits. Shipped
// resolutions: member_bound (scope policy + the member's own marks).
static consteval bool namespace_participates(std::meta::info ns, lang L, policy_kind pol,
std::meta::info bound_into);
// a nested namespace becomes a (recursed) submodule
static consteval bool counts_as_registered(std::meta::info type, lang L);
// the bindability gate's registration oracle: does welding under this
// resolution provide a registration for this class/enum type? A pure
// predicate of the declaration (never a visited-set), so welding in
// multiple passes and forward references stay order-independent — and
// hence no bound_into. marker_resolution: welded_for; greedy_resolution:
// any complete registrable type. Both extend the answer to NESTED
// (class-scoped) types — registered iff they resolve as members of a
// counting enclosing class (detail::nested_type_registered, the exact
// mirror of the carriage's nested-type sweep). A bespoke resolution
// that prunes types must mirror its pruning here, nested ones included.
// welder::welded_registration is the reusable (welded-only) default.

Plus one reflection-templated hook — it takes the derived type and a lang as non-type template arguments:

template <std::meta::info T, lang L> static consteval auto native_bases();
// T's native-base reflections (a std::array<std::meta::info, N>), spliced into
// the class handle by make_class

Optional hook** (detected via requires, so the concept does not demand it):

static consteval bool protected_participates(std::meta::info mem, lang L,
std::meta::info bound_into);
// arbitrates a PROTECTED class member's access admission. Absent, the
// carriage falls back to the declaring class's policy::weld_protected
// annotation. It is consulted only for protected members: public members
// are always admitted and PRIVATE members never are — the carriage
// hard-wires both before the hook (see detail::member_access_admitted),
// so no resolution can expose a private member. bound_into lets a hook
// scope the admission to a flattening target ("this mixin's protected
// members, but only into Derived"). A leftover two-argument hook is a
// hard error (a migration diagnostic), not silently ignored.

A concept cannot quantify over every T, so — exactly as welder::caster_oracle probes has_native_caster — this probes native_bases with the single placeholder welder::detail::any_type and checks only its shape (that the hook exists and yields a range of std::meta::info). The actual per-type instantiation is still exercised at the carriage's call site.

Template Parameters
Rthe candidate resolution type.

Definition at line 337 of file concepts.hpp.