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

連休ボケ大丈夫ですか? #33

Closed
ufcpp opened this issue May 8, 2021 · 5 comments
Closed

連休ボケ大丈夫ですか? #33

ufcpp opened this issue May 8, 2021 · 5 comments

Comments

@ufcpp
Copy link
Collaborator

ufcpp commented May 8, 2021

配信URL: https://www.youtube.com/watch?v=fZSL9Dc_8JY

連休中に書いてた記事の話と、「そろそろ休みボケ解消しようか」を目的とした配信。

GW 中に一応に レコード型 の話書いた。

C# 9.0 がらみの残タスク: ufcpp/UfcppSample#297
残りは nint と関数ポインターだけのはず。

関数ポインター…
たぶん一番使われるのはクロスプラットフォームの Native Interop (要は Xamarin との統合)と思われるものの、その作業が .NET 6 マイルストーンなので、利用箇所が少なすぎて紹介しづらい…

@ufcpp-live
Copy link
Owner

開幕から Java とか C++ な話にそれまくり。

C# にも int template ほしいという話あり…

GaloisField<_2> x;

interface INum { int Value { get; } }
struct _0 : INum { public int Value => 0; }
struct _1 : INum { public int Value => 1; }
struct _2 : INum { public int Value => 2; }
struct _3 : INum { public int Value => 3; }
struct _4 : INum { public int Value => 4; }
struct _5 : INum { public int Value => 5; }
struct _6 : INum { public int Value => 6; }
struct _7 : INum { public int Value => 7; }
struct _8 : INum { public int Value => 8; }

struct GaloisField<T>
    where T : INum
{
}

@ufcpp-live
Copy link
Owner

C# にも ownership モデルほしいんだけど…

一応、non-copyable なら…

https://ufcpp.net/blog/2017/12/noncopyable/

最近は公式に使ってる:
dotnet/roslyn-analyzers#3420

@ufcpp-live
Copy link
Owner

using System;

var x = new X();

using (x) { } // x のコピーかかってる

Console.WriteLine(x.Value); // 0

struct X : IDisposable
{
    public int Value;

    public void Dispose()
    {
        ++Value;
    }
}

@ufcpp-live
Copy link
Owner

using System;

var x = new X();

using (x) { } // x のコピーかかってる

Console.WriteLine(x.Value); // 0

ref struct X
{
    public int Value;

    public void Dispose()
    {
        ++Value;
    }
}

@ufcpp-live
Copy link
Owner

関数ポインターの記事書くの、実例がまだ少なくて困ってる話

実例あった: dotnet/runtime#39752

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants