Mads Torgersen

Results 29 comments of Mads Torgersen

Looking at this more, I don't think we can achieve all of these three goals at the same time: 1. `field` is a contextual keyword in such a way that...

Based on the discussion above around making `field` and `value` contextual keywords, I wrote up this proposal: https://github.com/dotnet/csharplang/issues/7964 Thanks everyone for all the insights here! ❤️

> > Declared unions can't have additional state, but function members can operate on the value of this itself. > > It feels like there is overlap here between this...

> Another area this doesn't seem to handle well woudl be something like `(T | U)`. In this case, due to unification, it would not be possible in all cases...

> The allocations suggested here I think would immediately disqualify this approach for any common monads like `Option` or `Result`. One goal of this proposal is to get away from...

> If the value that you are switching over is a boxed union (typed as object) can you ever match any of the constituent types? How would the generated code...

> If you are going to use records as implementations of tags w/ values for tagged union on top of type unions, and the value of the union is stored...

> Could we take a page from Nullable and have the runtime have special handling for the boxing side of this? That way you don't ever see the wrapper when...

> Wouldn't that make _all_ type checks more expensive? Yes, probably.