C# 14 and Discriminated Unions with Mads Torgersen

Поделиться
HTML-код
  • Опубликовано: 2 фев 2025

Комментарии • 47

  • @lmao01
    @lmao01 22 минуты назад +2

    Mads Torgersen and the way he talks about the language gives me confidence that this language has a future.

  • @benderbg
    @benderbg 2 часа назад +21

    Place your bets which one is coming first
    1. C# discriminated unions
    2. Java string interpolation
    3. GTA 6

  • @SimoLPers
    @SimoLPers 2 часа назад +3

    Great talk. I really like the laid back approach in these videos. Thanks for the great work!

  • @SanityIT
    @SanityIT 41 минуту назад

    Great interview but I wish that there was a side view where an example was showed for every topic and example that was talked about to make it easier to follow. You two are the absolute experts in this but for somebody learning it would be a great way to learn.

  • @DanGolick
    @DanGolick Час назад +2

    The biggest problem with nullable reference type is that the compiler won’t detect that properties/fields are initialized in a method called by the constructor. Instead I have to add MemberNotNull attributes to the initialization routines.

    • @Epsil0neR
      @Epsil0neR 41 минуту назад

      How about call the method like this "init(out MyProperty1, out MyProperty2)"? I think "out" operator will solve that warning.

    • @DanGolick
      @DanGolick 34 минуты назад

      @ that could work for field but you can’t use a property as an out parameter. The real point is that the compiler could easily analyze the initial methods to calculate what is guaranteed not to be null. It would only have to do this for methods called from constructors

    • @tan_x_dx
      @tan_x_dx 29 минут назад

      @@DanGolick "... the compiler could easily analyze the initial methods to calculate what is guaranteed not to be null."
      No, it really could not. Doing so would be equivalent to solving the halting problem.

    • @DanGolick
      @DanGolick 19 минут назад

      @ if it can do it for the body of the constructor it can do it for a method call

    • @tan_x_dx
      @tan_x_dx 15 минут назад

      @@DanGolick No, it really cannot. There is no limit to the complexity of a method call.
      Whereas in a constructor, it can tell if a value is assigned or not - that's the limit of what it can determine.

  • @PapLabros
    @PapLabros 47 минут назад

    1:22:36 gave his best Anakin impersonation

  • @rngesus8057
    @rngesus8057 Час назад

    1:29:55 nullable ref types are a pain... until u realize u dont need to null check everywhere!!!

  • @a-videoo
    @a-videoo Час назад +1

    14:15 on var ... wow

    • @Epsil0neR
      @Epsil0neR 48 минут назад

      field operator.
      Available in 13-preview. Plan to be released as part of C#14.

  • @DisturbedNeo
    @DisturbedNeo Час назад

    The STS / LTS version mismatch thing doesn’t make much sense as an argument.
    If your company has a “LTS-Only” policy, you’ll be on .NET 8 and v8 packages until .NET 10 comes out.
    If they don’t have that policy, then you can use .NET 9 with v9 packages.
    And even if that very unlikely scenario of .NET 8 with v9 packages occurs, .NET 10 will come out before .NET 9 is out of support.
    So no matter the policy, there’s always a version you can upgrade to.

  • @connorradeloff5597
    @connorradeloff5597 53 минуты назад

    I've never clicked on a video so fast

  • @rngesus8057
    @rngesus8057 Час назад +1

    1:22:40 yessss delegates are the worst

  • @abdulkadirbala2339
    @abdulkadirbala2339 3 часа назад +2

    Do you still do podcasts?

    • @abdulkadirbala2339
      @abdulkadirbala2339 3 часа назад

      Please do some more

    • @nickchapsas
      @nickchapsas  3 часа назад +7

      This is a podcast

    • @matsedv
      @matsedv 3 часа назад

      @@nickchapsas haha

    • @abdulkadirbala2339
      @abdulkadirbala2339 3 часа назад

      @@nickchapsasmy Bad, I was referring to the “Keep Coding” podcast

    • @nickchapsas
      @nickchapsas  3 часа назад

      It's the same thing, it's just on the main channel now

  • @FATPENGUIN96
    @FATPENGUIN96 Час назад

    24:00 haha, one sec just going to raise a PR at work

  • @thecodejunk
    @thecodejunk Час назад

    Nice talk 😎

  • @tedchirvasiu
    @tedchirvasiu 39 минут назад

    Mad lad

  • @promant6458
    @promant6458 3 часа назад +6

    There's something wrong with the sound, it's terrible to listen.

    • @nickchapsas
      @nickchapsas  3 часа назад +5

      Yeah I tried to fix it in post but that's the best I could do. I messed up the lav mic balance

    • @Th3MoL3
      @Th3MoL3 3 часа назад +11

      Lol it's not that bad dude 😂

    • @margosdesarian
      @margosdesarian 2 часа назад +5

      Its doable - just not excellent - no sweat !!

  • @dmip9884
    @dmip9884 2 часа назад

    var wars inside MS )

  • @sergeybenzenko6629
    @sergeybenzenko6629 2 часа назад

    Mads looks to me like a bit blurry person)))

  • @chadfranklin47
    @chadfranklin47 3 часа назад

    U last!

  • @TheOnlyDominik
    @TheOnlyDominik 3 часа назад +6

    KEEEEEEEEEEP C# easy!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Don't destroy C# like C++!!!

    • @JansthcirlU
      @JansthcirlU 2 часа назад +3

      As with anything, functional programming doesn't have to be difficult. In companies that rely on functional programming, they will naturally write code that's more complex, but the very fundamental concepts in functional programming, like immutability and function purity can be very helpful when combined with OOP. Zoran Horvat makes some very interesting videos about those challenges.

    • @TheOnlyDominik
      @TheOnlyDominik 2 часа назад

      @@JansthcirlU You can use F# if you want functional programming!

    • @fusedqyou
      @fusedqyou 2 часа назад +4

      @@JansthcirlU If there's somebody who does the opposite of easy it would be Zoran Horvat.

    • @diadetediotedio6918
      @diadetediotedio6918 Час назад

      @@fusedqyou
      Just because you don't like his approach don't mean he does "the opposite of easy", although easy is a pretty weaponized word anyways in programming (along with 'simplicity')

    • @diadetediotedio6918
      @diadetediotedio6918 Час назад

      bot.

  • @cuzsleepisthecousinofdeath
    @cuzsleepisthecousinofdeath 6 минут назад

    using System.Runtime.InteropServices;
    public enum Kind : int { isX, isY, isZ };
    [StructLayout(LayoutKind.Explicit)]
    public struct OneOf
    {
    [FieldOffset(0)] public Kind kind;
    [FieldOffset(4)] public X x;
    [FieldOffset(4)] public Y y;
    [FieldOffset(4)] public Z z;
    }