Skip to content

Change syntax of given whitebox macros #8619

Closed
@odersky

Description

@odersky

Status quo

inline def whiteBox1 <: T = ...
inline given whiteBox2 as _ <: T = ...

Critique

  • Syntax is not consistent
  • You could argue that the first syntax is too quiet and also misleading since at first glance whiteBox1 is in the position where you would expect to see a type.
  • _ <: T is technically wrong (or, rather, old style) since it suggests a lambda. We are after an existential instead.

Proposal

Write ? <: T (analogous to a wildcard type argument) to express both forms of whitebox macros. I.e.

inline def whiteBox1: ? <: T = ...
inline given whiteBox2 as ? <: T = ...

Opinions?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions