draft proposal for Sum Types for D
Per Nordlöw
per.nordlow at gmail.com
Tue Nov 29 15:42:33 UTC 2022
On Tuesday, 29 November 2022 at 06:26:20 UTC, Walter Bright wrote:
> Go ahead, Make My Day! Destroy!
>
> https://github.com/WalterBright/DIPs/blob/sumtypes/DIPs/1NNN-(wgb).md
DIP is missing
- Canonicalization of `sumtype` members. Specifically:
- Independence of order of members
`sumtype S {T,U}` should be the same as `sumtype S {U,T}`.
- Deduplication of members either as a compiler error or as a
silent automatic removal of duplicate types. Moreover, what about
`sumtype S {a T, b U}` vs `sumtype S {a U, b T}` and
`sumtype S {a T, b U}` vs `sumtype S {b T, a U}`?
For reference see how `mir.algebraic.Variant` canonicalizes
template type parameters using the trait `TypeSet` at
https://github.com/libmir/mir-core/blob/master/source/mir/algebraic.d#L447.
More information about the Digitalmars-d
mailing list