https://github.com/dotnet/csharplang/blob/main/proposals/simple-lambda-parameters-with-modifiers.md ```cs 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 がターゲット。 ```cs 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` は行ける)
Activity
[-]シンプルラムダ引数 (`(ref x) => ...`)[/-][+]シンプルラムダ引数[/+]ufcpp commentedon Nov 3, 2025
https://ufcpp.net/study/csharp/functional/fun_localfunctions/#simple-param-with-modifier
https://ufcpp.net/study/csharp/cheatsheet/ap_ver14/
ufcpp commentedon Nov 3, 2025
scopedという名前の型がある場合にちょっと破壊的変更になるみたいな話はレアケース(そんな名前の型を作るやついない)なので省略。