std.sumtype needs implicit conversion to reach its full potential.

StarCanopy starcanopy at protonmail.com
Wed Nov 17 03:49:41 UTC 2021


On Tuesday, 16 November 2021 at 11:15:27 UTC, FeepingCreature 
wrote:
> [...]

Yes! Another variation of this:

```d
SumType!(string, Err) doSomething() {
     // The dream: return Err("Something happened");
     return typeof(return)(Err("Something happened"));
}
```

I had to introduce a string mixin and some help functions into my 
result library to help alleviate this noise.

Perhaps the introduction of an `opImplicitConv` or something akin 
to this could help?


More information about the Digitalmars-d mailing list