Skip to content

CC: Better End-User Syntax for Declaring and Mentioning Capture Variables #22490

Closed
@bracevac

Description

@bracevac

Right now, the syntax for explicit capture polymorphism is quite noisy and irregular:

val b: Bar^ = ???
def capturePolyDef[A^,
                   B >: CapSet <: A,
                   C >: CapSet <: CapSet^{B^},
                   D >: CapSet <: C,
                   E >: CapSet <: CapSet^{D^},
                   F >: CapSet <: CapSet^{A^,b},
                   X >: CapSet <: CapSet^{F^,D^},
                   Y >: CapSet^{F^} <: CapSet^{F^,A^,b},
                   Z >: CapSet^{b} <: CapSet^{b,Y^}] = ???

For example:

  • There are too many hats ^ and it's not always clear when they are needed, e.g., all the type variables in the example are capture variables, but only A's declaration carries the ^ (which is a shorthand for A >: CapSet <: CapSet^.

  • There's two ways to write down a capture variable's bounds, e.g., E's upper bound is CapSet^{D^} but could equivalently be written as just D.

  • Lots of CapSet mentions everywhere, which seems a bit clunky to express simple subset relationships.

  • TODO: how does/will Capybara affect capture set notations?

Let's use this issue to track ideas for making the notations more palatable.

Metadata

Metadata

Labels

area:experimental:ccCapture checking relatedcc-experimentIntended to be merged with cc-experiment branch on origin

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions