Skip to content

pre-SIP: Underscore Syntax for Type Lambdas #5379

Open
@odersky

Description

@odersky

We'd like to eventually use F[_] as a short-hand syntax for the type lambda [X] => F[X]. It would mean we have to switch regular wildcard syntax to F[?]. The problem is that this is the syntax currently used by KindProjector, because _ was unavailable. The tricky bit is how to shift things around?

We need a multi-version strategy for this. I am starting the version count at 3.0, but it could also be something else, 2.14, or even 2.13.

  • Scala 3.0: Both _ and ? mean "wildcard". Native type lambdas remove the most pressing need for kind projector. If kind projector is still needed, it would use something else ("__" maybe?)

  • Scala 3.1: _ is deprecated for wildcards

  • Scala 3.2: _ is removed for wildcards

  • Scala 3.3: _ is introduced as a shorthand for type lambdas

If type lambdas get introduced in 2.13, and 2.14, we could also start this process sooner.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions