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

C# 9.0 #297

Closed
19 tasks done
ufcpp opened this issue May 9, 2020 · 13 comments
Closed
19 tasks done

C# 9.0 #297

ufcpp opened this issue May 9, 2020 · 13 comments
Labels

Comments

@ufcpp
Copy link
Owner

ufcpp commented May 9, 2020

https://github.com/ufcpp/UfcppSample/tree/master/Demo/2020/Csharp9_0

issue 建てた当初の話

.NET が年1リリースになるのに合わせるっぽいので、 .NET 5 時点(2020/11)で C# 9.0 が出そう。
(断言まではしてないけどそんな雰囲気でいろいろ作業が進んでる。)

.NET 5 Preview 2 辺り(2020/3)からちらほらと C# 9.0 の実装始まってて、LangVersion preview 指定で試せます。

とりあえずページ作った https://ufcpp.net/study/csharp/cheatsheet/ap_ver9/

.NET 5 Preview 2 時点

  • lambda discard parameters
  • attributes on local functions
  • skip locals init

https://ufcpp.net/blog/2020/4/begginingcs9/

VS 16.7 p1 時点

  • native int #346
  • target-typed new
  • pattern V3
    • x is not T t は preview 3 で入った

https://ufcpp.net/blog/2020/5/cs9net5p4/
ufcpp-live/UfcppLiveAgenda#7

VS 16.7 p2 時点

  • extending partial method
    • Source Generator 的なページを1個新設?
    • C# 2.0 時代からある既存 partial の説明もちゃっちいのしかないので書き足してもいいかも
    • C# 9.0 時点ではメソッドのみ(partial プロパティの需要結構高い。提案はある)

https://ufcpp.net/blog/2020/6/ExtendingPartialMethod

VS 16.7 p3 時点

https://ufcpp.net/blog/2020/6/cs9vs16_7p3/

  • top-level statements
  • function pointers #347
  • records
    • init-only プロパティの話だけ先にする方がいいかも?
    • with 式
    • record 型
    • プライマリ コンストラクター (positional record)

data 修飾子はたぶん C# 10..0 行き。

VS 16.8 p1 時点

https://ufcpp.net/blog/2020/8/vs168p1/

  • module initializers
  • static anonymous functions
  • target-typed conditional expression

VS 16.8 p2 時点

https://www.youtube.com/watch?v=Uc04x0eZBBM

C# には大した変更入ってないと思ってたけども…

  • covariant returns このバージョンから 入ってるかも 入ってた
  • extension GetEnumerator も入ってそう
  • 特にアナウンスはないけどいくつか NRT の修正あり
    • unconstrained generic type parameter の T? (実質、defaultable)
@ufcpp
Copy link
Owner Author

ufcpp commented Jun 29, 2020

そういや、関数ポインターは ref も普通に書ける…
これもデリゲートにもほしい…

using System;

class Program
{
    unsafe static void Main()
    {
        delegate*<ref int, void> f = &M;
        var x = 1;
        f(ref x);
    }

    static void M(ref int x) { }
}

@ufcpp

This comment has been minimized.

@ufcpp ufcpp added the C# 9.0 label Jul 4, 2020
@ufcpp
Copy link
Owner Author

ufcpp commented Jul 7, 2020

warning waves も .NET 5 のタイミングで入りそう。
struct に対する x == null とかに警告を出したいらしい。

@ufcpp

This comment has been minimized.

@ufcpp

This comment has been minimized.

@ufcpp

This comment has been minimized.

@ufcpp

This comment has been minimized.

@ufcpp

This comment has been minimized.

@ufcpp

This comment has been minimized.

@ufcpp

This comment has been minimized.

@ufcpp

This comment has been minimized.

@ufcpp
Copy link
Owner Author

ufcpp commented Mar 7, 2021

init-only プロパティの話 https://ufcpp.net/study/csharp/oo_property.html#init-only に書いた。
「with 式については別途説明予定」、「modreq については別途説明予定」の記載あり。

@ufcpp
Copy link
Owner Author

ufcpp commented Nov 24, 2022

残り #347 (unsafe な低需要機能)だけだしこっち閉じちゃうか…

@ufcpp ufcpp closed this as completed Nov 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant