dotnet / dotnet/csharplang

[Proposal]: User-defined positional patterns

Open
#8,613 0 comments 0 reactions 1 assignee Claimed by @333fred View on GitHub
Proposal champion
Dominant language
C#
Stars
12.7k
Forks
1.1k
Avg merge
11h 1m
Merged PRs (30d)
3

Description

# User-defined positional patterns

* Specification: https://github.com/dotnet/csharplang/discussions/8612
* Discussion: https://github.com/dotnet/csharplang/discussions/8612
*
## Summary
[summary]: #summary

Defining a named positional pattern which is not bound to a type check.

Exploring a different approach than the one originally presented in https://github.com/dotnet/csharplang/issues/1047 which suggests to relax `Deconstruct` to return `bool`.

This proposal does not conflict with bool-returning `Deconstruct` methods, i.e. both can exist at the same time, but this enables much more flexibility in this space as these patterns have a name of their own rather than just using the type's name.

## Design meetings

https://github.com/dotnet/csharplang/blob/main/meetings/2022/LDM-2022-02-16.md#user-defined-positional-patterns

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.