3 ms·
Ive been writing compiler in C# and I dont see anything fancy here except union type Ive personally decided to avoid visitor pattern bloat and Im waiting for c
by hardware2win 3y ago
Ive been writing compiler in C# and I dont see anything fancy here except union type
Ive personally decided to avoid visitor pattern bloat and Im waiting for closed enum feature in order to have compile time exhaustive check
- AgentME 3y agoI find myself really missing union types when I'm in a language that doesn't have either it or Rust-style enums. The usual alternatives are awkward: either one class representing the union type containing N nullable properties with the documented condition that only one property is ever expected to be non-null, a condition the type system isn't able to check or make use of, or multiple classes extending a common class, which feels really heavyweight. Both solutions require some duplication or clever composition if you want several different overlapping union types.