3 ms·
The DU stuff is enormous once you consider all the corners it touches. Especially with refinements. E.g. in code like if (s is string or s is int) { // what
by alkonaut 2y ago
The DU stuff is enormous once you consider all the corners it touches. Especially with refinements. E.g. in code like
if (s is string or s is int) {
// what's the type of s here? is it "string | int" ?
}
And not to mention that the BCL should probably get new overloads using DU's for some APIs. But there is at least a work in progress now, after years of nothing.
- colejohnson66 2y agoOne of the claimed benefits of .NET Core was that they could improve the runtime at a much faster pace than .NET Framework did, especially if that meant adding new features or even IL opcodes. And they've done this before, with a big one (IMO) being ref fields in ref structs. Lately, when it comes to developing C#, the language design team has frustratingly been trying to shoehorn everything into the compiler instead of modifying the runtime. Then they say the runtime should be modified to pattern-match what they output. If DUs are to be implemented fully in C#, niches would probably be impossible. This means Optional<T>, when T is a class, would take two words.