Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update simple-lambda-parameters-with-modifiers.md #8487

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion proposals/simple-lambda-parameters-with-modifiers.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ implicit_anonymous_function_parameter_list

implicit_anonymous_function_parameter
- : identifier
+ : 'scoped'? anonymous_function_parameter_modifier? identifier
+ : attributes? 'scoped'? anonymous_function_parameter_modifier? identifier
;

explicit_anonymous_function_parameter
Expand Down Expand Up @@ -75,6 +75,12 @@ to those that have no out parameters.
+ is restricted to those that have the same modifiers in the same order (§10.7).
```

## Open LDM questions

1. Currently (in C# 13 `(scoped x) => ...` means "A lambda with a parameter named 'x' with type 'scoped'". We would like to change that to be treated as the "scoped modifier" instead. We can gate this behind a language version change so it only breaks on upgrade. There is also a suitable user workaround if they truly had this pathological code. Namely, writing `(@scoped x) => ...`.

2. A prior LDM meeting established that neither attributes nor default parameter values would be supported on simple lambda parameters with modifiers. I would like to revist the decision about attributes. Specifically, we already allow attributes on simple lambdas like `([Attr] a) => ...` in the compiler today. So it would be weird to have that support, but have it break if you changed it to `([Attr] ref a) => ...`. Note: default parameter values are not supported on simple lambdas. So we can keep the rule that they continue to not be supported when modifiers are added.

## Answered LDM questions

### Allowing attributes or default parameter values
Expand Down