Second draft: Sum Type by Struct

DanielG simpletangent at gmail.com
Thu Sep 3 22:11:33 UTC 2026


Why the highly-idiosyncratic declaration syntax (for a 
language-supported sumtype)?

**If the proposal was for Typescript-style type unions, OK.** But 
this is for sumtypes.

Why not something more like 
Swift/Rust/Scala/ML/Haxe/Beef/C#15/every other language with 
these?

```
sumtype MySumType {
   Case1,
   Case2(int x, string y),
   Case3(MyStruct s)
}
```

Regardless of implementation, in languages with first-class 
support, conceptually sumtypes are just enums with parameterized 
values.

Your syntax/semantics would make perfect sense for 
Typescript-style type unions: compact declaration, no need for 
names, etc. But for proper sumtypes, this seems exotic and 
idiosyncratic. I would much prefer D be very boring and 
predictable in this regard.


More information about the dip.development mailing list