Thread overview
std.sumtype nested SumTypes
Jan 22
NonNull
Jan 22
ryuukk_
Jan 22
NonNull
Jan 27
NonNull
January 22

I am defining a new value type (small struct) from some old value types that are already SumTypes.

So I want to have some SumTypes as some of the alternative types in another SumType.

How how efficient this is, including space efficient?

January 22

On Monday, 22 January 2024 at 16:16:56 UTC, NonNull wrote:

>

I am defining a new value type (small struct) from some old value types that are already SumTypes.

So I want to have some SumTypes as some of the alternative types in another SumType.

How how efficient this is, including space efficient?

Without knowing what you are doing, this sounds like a bad idea, i suggest to revise your design

January 22

On Monday, 22 January 2024 at 16:35:39 UTC, ryuukk_ wrote:

>

On Monday, 22 January 2024 at 16:16:56 UTC, NonNull wrote:

>

I am defining a new value type (small struct) from some old value types that are already SumTypes.

So I want to have some SumTypes as some of the alternative types in another SumType.

How how efficient this is, including space efficient?

Without knowing what you are doing, this sounds like a bad idea, i suggest to revise your design

I'd like SumType to combine the implicit tags so there's only one tag.

January 22

On Monday, 22 January 2024 at 21:11:17 UTC, NonNull wrote:

>

I'd like SumType to combine the implicit tags so there's only one tag.

SumType does not do this automatically (because sometimes you might want to keep the inner SumTypes separate), but you can do it yourself like this:

alias A = SumType!(X, Y);
alias B = SumType!(Z, W);
alias C = SumType!(A.Types, B.Types);
January 27

On Monday, 22 January 2024 at 21:36:47 UTC, Paul Backus wrote:

>

SumType does not do this automatically (because sometimes you might want to keep the inner SumTypes separate), but you can do it yourself like this:

alias A = SumType!(X, Y);
alias B = SumType!(Z, W);
alias C = SumType!(A.Types, B.Types);

Very nice!