Yes. We do. And unions should work well in F#. It's designed to be a very easy pattern for all CLR languages and compilers to understand (including F#).
Hi there! One of the C# lang designers here. I discuss that here: https://news.ycombinator.com/item?id=48255658 Note that my expectation would be that the non-boxed form would be as trivial as adding…
Hi there. One of the C# lang designers here. You're correct. The unions we're working on right now are 'type unions'. So the type is inherent in the union distinction, and you would not be able to distinguish that case.…
Hi there, one of the C# lang designers here. I discuss this a bit in https://news.ycombinator.com/item?id=48255658. Contrary to what a lot of people guess, boxing is actually a really good strategy most of the time.…
Hi there! C# language designer here, and one of the people working on unions. Boxing is not something inherently to be avoided. It actually can work better in many (most?) use cases, and avoids a lot of problems that…
> Would something like `List<int> = new(capacity: 10)[1, 2, 3]` have been possible? Great question. And our design docs, and discussion with the community cover this. The reason that was eliminated as an option (we…
There isn't any such pressure. These features only happen because someone goes out of their normal job space to push for the necessity for them. All of the design team have full time work on other things. The design and…
> Having to opt-in like the current preview shows it looks like a PITA that I'd quickly become tired of. My belief is that we will have a `union struct` just like we have `record` and `record struct`. Where you can…
How do you define "objectively illogical" here?
Sure, as an example: https://github.com/dotnet/csharplang/blob/main/meetings/work... Again, very rough. We go round and round on things. Loving to decompose, debate and determine how we want to tackle all these large…
> I guess I overdramatized the situation a bit :) It's a passionate topic for me; as somebody who has been using C# at work for 10 years now, I'm just not happy with the direction the language has been taking. You…
Hi there. Designer of this feature :D > is non-intuitive and unnecessary. intuitive is definitely in the eye of the beholder. When people saw: `HashSet<string> people = [with(StringComparer.CaseInsensitiveComparer), ..…
Hi there! One of the C# language designers here, working on unions. We're very interesting in this space. And we're referring to it as, unsurprisingly, 'anonymous unions' (since the ones we're delivering in C#15 are…
Hi there! One of the C# language designers here, working on unions. And the author of that feature :D So I'm happy to discuss the thinking here. It's not about saving keystrokes. It's about our decision that users…
Hi there! One of the C# language designers here, working on unions. We're extremely interested in discriminated unions. A real problem is that there so much interest, with many varying proposals on how best to do them.…
Hi there! One of the C# language designers here, working on unions. All the different options have tradeoffs. As an example, the non-boxing options tear, which can be problematic. And, we have a lot of experience…
Hi there! One of the C# language designers here, working on unions. We're interesting in both forms! We decided to go with this first as felt there was the most value here, and we could build the named form on top of…
I wrote several of typescript's initial compilers. We didn't use red/green for a few reasons: • The js engines of the time were not efficient with that design. This was primarily testing v8 and chakra (IE/edge's prior…
> I'm curious how you can make such statements involving absolute time values, without specifying what the minimum hardware requirements are. That's a very fair point. In this case. I'm using the minimum requirements…
> Hmm, the strong reason could be latency and layout stability. Tree-sitter parses on the main thread (or a close worker) typically in sub-ms timeframes One of the designers/architects of 'Roslyn' here, the semantic…
C# Language Designer here, and one of the designers/architects of 'Roslyn', the semantic analysis engine that powers the C#/VB compilers, VS IDE experiences, and our LSP server. The original post conflates some concepts…
Sure. But that was the case prior to this feature as well. Previously you'd have to store the variable somewhere and null check it. Those could all lead to different outcomes. This just encapsulates that pattern safely…
Hi there! Lang designer here. > More concise? Yes. Note: being more concise is not really the goal of the `?` features. The goal is actually to be more correct and clear. A core problem these features help avoid is the…
Hi there, one of the lang designers here :) Think of it this way. We already supported these semantics in existing syntax through things like invocations (which are freely allowed to mutate/write). So…
Hard problems take time :) They also often need a lot of scaffolding to be built along the way. We like breaking hard problems into much smaller, composable, units that we can build into the language and then compose to…
Yes. We do. And unions should work well in F#. It's designed to be a very easy pattern for all CLR languages and compilers to understand (including F#).
Hi there! One of the C# lang designers here. I discuss that here: https://news.ycombinator.com/item?id=48255658 Note that my expectation would be that the non-boxed form would be as trivial as adding…
Hi there. One of the C# lang designers here. You're correct. The unions we're working on right now are 'type unions'. So the type is inherent in the union distinction, and you would not be able to distinguish that case.…
Hi there, one of the C# lang designers here. I discuss this a bit in https://news.ycombinator.com/item?id=48255658. Contrary to what a lot of people guess, boxing is actually a really good strategy most of the time.…
Hi there! C# language designer here, and one of the people working on unions. Boxing is not something inherently to be avoided. It actually can work better in many (most?) use cases, and avoids a lot of problems that…
> Would something like `List<int> = new(capacity: 10)[1, 2, 3]` have been possible? Great question. And our design docs, and discussion with the community cover this. The reason that was eliminated as an option (we…
There isn't any such pressure. These features only happen because someone goes out of their normal job space to push for the necessity for them. All of the design team have full time work on other things. The design and…
> Having to opt-in like the current preview shows it looks like a PITA that I'd quickly become tired of. My belief is that we will have a `union struct` just like we have `record` and `record struct`. Where you can…
How do you define "objectively illogical" here?
Sure, as an example: https://github.com/dotnet/csharplang/blob/main/meetings/work... Again, very rough. We go round and round on things. Loving to decompose, debate and determine how we want to tackle all these large…
> I guess I overdramatized the situation a bit :) It's a passionate topic for me; as somebody who has been using C# at work for 10 years now, I'm just not happy with the direction the language has been taking. You…
Hi there. Designer of this feature :D > is non-intuitive and unnecessary. intuitive is definitely in the eye of the beholder. When people saw: `HashSet<string> people = [with(StringComparer.CaseInsensitiveComparer), ..…
Hi there! One of the C# language designers here, working on unions. We're very interesting in this space. And we're referring to it as, unsurprisingly, 'anonymous unions' (since the ones we're delivering in C#15 are…
Hi there! One of the C# language designers here, working on unions. And the author of that feature :D So I'm happy to discuss the thinking here. It's not about saving keystrokes. It's about our decision that users…
Hi there! One of the C# language designers here, working on unions. We're extremely interested in discriminated unions. A real problem is that there so much interest, with many varying proposals on how best to do them.…
Hi there! One of the C# language designers here, working on unions. All the different options have tradeoffs. As an example, the non-boxing options tear, which can be problematic. And, we have a lot of experience…
Hi there! One of the C# language designers here, working on unions. We're interesting in both forms! We decided to go with this first as felt there was the most value here, and we could build the named form on top of…
I wrote several of typescript's initial compilers. We didn't use red/green for a few reasons: • The js engines of the time were not efficient with that design. This was primarily testing v8 and chakra (IE/edge's prior…
> I'm curious how you can make such statements involving absolute time values, without specifying what the minimum hardware requirements are. That's a very fair point. In this case. I'm using the minimum requirements…
> Hmm, the strong reason could be latency and layout stability. Tree-sitter parses on the main thread (or a close worker) typically in sub-ms timeframes One of the designers/architects of 'Roslyn' here, the semantic…
C# Language Designer here, and one of the designers/architects of 'Roslyn', the semantic analysis engine that powers the C#/VB compilers, VS IDE experiences, and our LSP server. The original post conflates some concepts…
Sure. But that was the case prior to this feature as well. Previously you'd have to store the variable somewhere and null check it. Those could all lead to different outcomes. This just encapsulates that pattern safely…
Hi there! Lang designer here. > More concise? Yes. Note: being more concise is not really the goal of the `?` features. The goal is actually to be more correct and clear. A core problem these features help avoid is the…
Hi there, one of the lang designers here :) Think of it this way. We already supported these semantics in existing syntax through things like invocations (which are freely allowed to mutate/write). So…
Hard problems take time :) They also often need a lot of scaffolding to be built along the way. We like breaking hard problems into much smaller, composable, units that we can build into the language and then compose to…