News for hackers. Stuff that matters.
Re:Explore union types in C# 15 by repelsteeltje on Wednesday April 08, 2026 @02:41PM (#47694441)
Not sure, but I think C++ actually does allow std::variant with multiple choices using the same type. You might not be able to distinguish between them by type (using get<Type>()), but you can by position (get<0>(), get<1>(), ...)
Re:Explore union types in C# 15 by amluto on Wednesday April 08, 2026 @04:15PM (#47695695)
I haven’t tried this, and I don’t intend to, because visitors and similar won’t work (how could they?) and I don’t want to have to think about which is choice 2 and which is choice 7.
Re:Explore union types in C# 15 by NooneAtAll3 on Wednesday April 08, 2026 @03:38PM (#47695224)
I think GP is talking about name-of-field access, not index access or name-of-type