@Incubating
public final class Comprehensions
extends Object
Runtime bind/map dispatcher for monadic comprehensions — the emit target
of the DO macro.
The macro runs at SEMANTIC_ANALYSIS, before type checking, so it
cannot know the carrier's bind-method name and cannot emit it directly. Instead it
emits Comprehensions.bind(carrier) { x -> ... } calls; this class resolves
the carrier-specific method at runtime (dynamic Groovy), while the
groovy.typecheckers.MonadicChecker type-checking extension specialises this
one signature under @CompileStatic.
This is runtime support invoked from generated bytecode, hence its placement in
core alongside the rest of the Groovy runtime; the DO macro and the type
checker are compile-time only and remain in their optional modules.
Participation is resolved first-match-wins:
flatMap/map present);@Monadic opt-in (matched by simple name; honours bind/map overrides).
Surface generosity: the carrier's bind method may accept a Function or a
Closure; the closure is adapted to whichever the target declares. Monad
laws are not enforced — structural participation, algebraic-law obligation
on the implementer (the @Reducer/@Associative treatment).