Hi D
I've a simple question but it's bedeviling me anyway. How do I
get a string representation of the current type of a SumType?
I'm trying to avoid something like this:
```d
alias Vec3 = SumType!(void* /* invalid vector */, byte[3],
short[3], char[][3]);
string prnType(Vec3 vec){
re
On Sunday, 1 October 2023 at 01:17:50 UTC, Chris Piker wrote:
```d
alias Vec3 = SumType!(void* /* invalid vector */, byte[3],
short[3], char[][3]);
```
I know it's bad form to reply to my own question, but I think I
found a reasonably simple way:
```d
string prnType(Vec3 vec){
return
On Sunday, 1 October 2023 at 01:17:50 UTC, Chris Piker wrote:
Hi D
I've a simple question but it's bedeviling me anyway. How do I
get a string representation of the current type of a SumType?
I'm trying to avoid something like this:
```d
alias Vec3 = SumType!(void* /* invalid vector */, by
We posted at the same time! Thanks for help nonetheless.
I do hope over time, SumTypes get the Ali Çehreli treatment. I
keep his book open on my desk all the time.
Hi D
As suggested in other threads I've tried wrapping a SumType in a
structure to add functionality and used `alias ... this` to make
assignment, etc. easier. However the following code fails in dmd
2.105.2.
```d
import std.sumtype;
struct Item{
SumType!(void*, byte[3], ubyte[3], strin
```d
void main() {
import std.string : split;
import std.algorithm.searching : startsWith;
string bk="Exo";
assert(("Gen Exo Lev Num Deu Jos Judg Rut 1Sam 2Sam".split~
"1Kin 2Kin 1Chr 2Chr Ezra Neh Est Job Psa Pro Ecc Son
Isa Jer".split~
"Lam Eze Dan Hos
On Sunday, 1 October 2023 at 05:33:36 UTC, Joel wrote:
```d
void main() {
import std.string : split;
import std.algorithm.searching : startsWith;
string bk="Exo";
assert(("Gen Exo Lev Num Deu Jos Judg Rut 1Sam 2Sam".split~
"1Kin 2Kin 1Chr 2Chr Ezra Neh Est Job Psa Pr