Skip to content

[Wildcard Variables][spec] Can we reuse _ as a non-binding name in function types or record types? #3791

@srawlins

Description

@srawlins

Today, it is illegal to repeat _ as a name in these spots:

// The name '_' is already defined.
typedef T = void Function(String _, String _);

// The name '_' is already defined.
typedef void F2(_, _);

// The name '_' is already defined.
void f(void g(_, _)) {}

I don't believe function types are addressed in the current spec. Should the code above be legal under the wildcards feature?

As for records, it is already illegal to name a positional record field _, as "record field names can't be private."

typedef R = (String _, String _);

Would this code become legal under the wildcards feature? Such names would maybe not be considered "private" any longer?

@kallentu @munificent

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions