digitalmars.D.learn - std.sumtype nested SumTypes
- NonNull (5/5) Jan 22 I am defining a new value type (small struct) from some old value
- ryuukk_ (3/8) Jan 22 Without knowing what you are doing, this sounds like a bad idea,
- NonNull (3/13) Jan 22 I'd like SumType to combine the implicit tags so there's only one
- Paul Backus (7/9) Jan 22 SumType does not do this automatically (because sometimes you
- NonNull (2/8) Jan 26 Very nice!
I am defining a new value type (small struct) from some old value types that are already `SumType`s. So I want to have some `SumType`s as some of the alternative types in another `SumType`. How how efficient this is, including space efficient?
Jan 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 `SumType`s. So I want to have some `SumType`s 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
Jan 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'd like SumType to combine the implicit tags so there's only one tag.I am defining a new value type (small struct) from some old value types that are already `SumType`s. So I want to have some `SumType`s 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
Jan 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);
Jan 22
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!
Jan 26