Other articles


  1. Emulating ADTs in C# 9+

    The most upvoted language request for C# is discriminated unions. As of 2023, the proposal is now 6 years old. There are many reasons for that -- the feature has many different design variants, it interacts heavily with with other language features, it can have performance implications, and, most significantly, it …

    read more
  2. RAGRETS.md: Bad default()s

    This post is part of my continuing series on language regrets, where I discuss things I regret about C# and would avoid in a reboot. I previously wrote about covariant arrays, which is a widely regretted feature among the C# design team. This time I'd like to talk about my …

    read more
  3. The Anti-Constraint

    As ref structs in C# have become more popular, their interaction with generics has become a more common pain point. In particular, the restriction that ref structs cannot be substituted for generic parameters is rough. The basic problem with generics is pretty simple: ref structs have a variety of special …

    read more
  4. RAGRETS.MD

    A while back Swift developer Joe Groff tweeted a proposal that projects have a REGRETS.MD file describing "regretful design choices that can't be reversed for time, compatibility, etc. reasons." This seems like a good idea, both to help developers who are trodding similar ground, and also for me to …

    read more
  5. Lambdas and Local Functions

    Ever since local functions were added in C# 7 a common user question has been, "when should I use them instead of a lambda?" They're both forms of functions that can be nested within other functions, so it's reasonable to ask what the difference is. First, it's probably useful to …

    read more
  6. Stamping Git SHAs into Your Binaries

    Have you ever looked at a binary from a project you wrote and asked, "Where the hell are the sources for this?" Well, I'm about to make your life (and the lives of your customers) a bit easier. I'm going to show you how to write the Git SHA1 for …

    read more
  7. Cool Colors in WSL/Bash

    As some may know, before joining Microsoft to work on the C# compiler I was a pretty dedicated Linux user (Arch, thanks for asking) and despite finding replacements for a number of my Linux workflow standbys, I've never found a good substitute for the Unix shell. Enter the Windows Subsystem …

    read more

social