Closed ufcpp closed 1 year ago
// これ行けたくせに
using List = System.Collections.Generic.List<(int x, int y)>;
// これも行けたくせに
using T1 = System.ValueTuple<int, int>;
// これ、今回からやっと書けるように。
using Tuple = (int X, int Y);
// そもそも using alias 使う場面が少な目
// あまりにも長い奴
using D = System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<int>>;
// 同名クラスがあって弁別するため
using Enumerable = System.Linq.Enumerable;
// 環境によって変えるとか、後から変えたいとか
#if X86
using T = System.Single;
#else
using T = System.Double;
#endif
なので、 using alias any type が入ってうれしい場面あるとしたら…
// 長い奴の例、関数ポインターは長くなりがち。
using unsafe fp = delegate* unmanaged[Cdecl]<int, (int x, int y), string, void>;
// delegate* <fp, fp> は書けないので
using unsafe fp2fp = delegate*<delegate* unmanaged[Cdecl]<int, (int x, int y), string, void>, delegate* unmanaged[Cdecl]<int, (int x, int y), string, void>>;
// 変えたいやつの例、double 書けるようになるのはありがたいかも
#if X86
using T = float;
#else
using T = double;
#endif
// 後から変えたいやつでいうと、
using T = (int x, int y); // 後々 record struct に置き換えるかも。
using P1 = int;
using P2 = int;
using P3 = int;
// 所詮エイリアス。
P1 x1 = 1;
P2 x2 = x1;
P3 x3 = x2;
// ところが、 csharplang/discussions/7110 には
// strong-typedef にしたい話が多々…
{ }
// これなら strong-typedef 相当になるよ。
record struct P1(int Value);
record struct P2(int Value);
record struct P3(int Value);
// もちろん、int の + とかの引き継がれなくて面倒なのはあるものの…
// 同時期に進行してる explicit extension を使えばいいはず
// これならちゃんと strong-typedef 相当になるよ。
explicit extension P1 for int;
explicit extension P2 for int;
explicit extension P3 for int;
報告案件?
void m(int x)
{
void n()
{
x = 1;
}
}
partial class A(int x)
{
public void M() => x = 1; // ここに何か suggest 出てるけどなんか変
}
配信URL: https://www.youtube.com/watch?v=2QwM7Yk4KIY
SDK/Runtime
SDK の差分 core/issues/8135 に。 Simplified output path はちょっと試してみてる感じだとちゃんと働いてるように見えないんだけども。
C
https://twitter.com/ufcpp/status/1645947740436955142
https://ufcpp.net/blog/2023/1/using-alias-any-types/ を書いた頃から変更なし。
↑の今回入ったusing aliasに加えて、今まで入った分のlambda default、primary constructor含めて紹介記事あり:
https://devblogs.microsoft.com/dotnet/check-out-csharp-12-preview/
フィードバック求めてる。 primary constructor燃えそうな気がしなくもない。