-
-
Notifications
You must be signed in to change notification settings - Fork 40
Open
Labels
Description
https://github.com/dotnet/csharplang/blob/main/proposals/simple-lambda-parameters-with-modifiers.md
D d1 = (int x, ref int y) => { }; // OK
D d2 = (x, ref int y) => { }; // NG
D d3 = (x, ref y) => { }; // これをできるようにしたい
delegate void D(int x, ref int r);
// ref はそんなに使わないかもしれないけど、
// こんな out あるでしょ?
delegate bool TryParse<T>(string x, out T value);
in, ref, out, ref readonly, scoped がターゲット。
D d = (w, in x, ref y, out z, scoped s) => z = 0;
delegate void D(int w, in int x, ref int y, out int z, scoped Span<int> s);
メモ:
- 「
scoped
という名前のクラスが元々あった」みたいなアレな状況では一応破壊的変更があり得る。一応。 params
は対象外(対象にするかどうか?議論はあったけど否決)()
なしはダメ。ref x => ref x
はエラー((ref x) => ref x
は行ける)