Closed asutton closed 9 years ago
Currently, the discriminated variants are defined as variant(T) { } where T is the discriminator type. However, this design doesn't work well with the existing parameterization mechanics. For example:
variant(T) { }
T
def V(t : typename) -> typename = variant(int) { 0 : bool; 1 : t; } def v: V(int)(0); // Looks weird.
A better approach would be to make the variant dependent on a parameter in the declarator, like this:
def V(n : int) -> typename = variant(n) { ... }
This is more consistent, and the pattern probably generalizes nicely for other dependent types.
Fixed in f26ab70895e5d1a7373d1959d5e67598a99fb505 and a1fcc2e2b52e26a1382bbfc5bdd26bf64d83d223.
Currently, the discriminated variants are defined as
variant(T) { }
whereT
is the discriminator type. However, this design doesn't work well with the existing parameterization mechanics. For example:A better approach would be to make the variant dependent on a parameter in the declarator, like this:
This is more consistent, and the pattern probably generalizes nicely for other dependent types.