Paul King created GROOVY-12528:
----------------------------------

             Summary: GEP-23: user-configurable monadic carrier registration 
(Groovy 7)
                 Key: GROOVY-12528
                 URL: https://issues.apache.org/jira/browse/GROOVY-12528
             Project: Groovy
          Issue Type: New Feature
          Components: groovy-macro-library, groovy-typecheckers
            Reporter: Paul King
             Fix For: 7.x


Groovy 6.0 shipped the DO comprehension with a built-in carrier allow-list only 
(MonadicCarrierRegistry). GEP-23 deferred to 7.0 a configuration channel that 
lets applications and libraries extend that registry, covering both the runtime 
bind/map dispatcher and the MonadicChecker/MonadicShapeChecker type-checking 
extensions without divergence.

This umbrella tracks that work:
* Shared carrier resolver for the checkers and the runtime dispatcher 
(prerequisite).
* Registration channel.
* Typing DO generator variables from @ClosureParams on Closure-typed binds.

h3. Decision needed: where the bound type comes from

The type a DO generator variable is bound to can come from several sources. 
GROOVY-12486 (6.0.1) reads it from the bind function's input, e.g. R of 
Either<L, R>.flatMap(Function<? super R, ...>), and otherwise falls back to the 
carrier's first type argument. Future sources are a registration entry and 
@ClosureParams. Proposed precedence, pending team review:
# a bound type declared by a registration entry, if registration provides one
# the bind function's input type, resolved against the receiver's type arguments
# @ClosureParams on a Closure-typed bind parameter
# the carrier's first type argument
# Object

Only option 1 covers third-party carriers with untyped binds, since library 
classes cannot be annotated. An alternative to option 3 is a new @Monadic 
attribute, but @ClosureParams is an existing annotation that static type 
checking already honours on direct calls.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to