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?
Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
January 22 std.sumtype nested SumTypes | ||||
---|---|---|---|---|
| ||||
I am defining a new value type (small struct) from some old value types that are already So I want to have some How how efficient this is, including space efficient? |
January 22 Re: std.sumtype nested SumTypes | ||||
---|---|---|---|---|
| ||||
Posted in reply to NonNull | 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 So I want to have some 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 Re: std.sumtype nested SumTypes | ||||
---|---|---|---|---|
| ||||
Posted in reply to ryuukk_ | 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 So I want to have some 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 Re: std.sumtype nested SumTypes | ||||
---|---|---|---|---|
| ||||
Posted in reply to NonNull | 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:
|
January 27 Re: std.sumtype nested SumTypes | ||||
---|---|---|---|---|
| ||||
Posted in reply to Paul Backus | 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:
Very nice! |