DIP 1017--Add Bottom Type--Final Review
Paul Backus
snarwin at gmail.com
Wed Jan 16 23:47:12 UTC 2019
On Wednesday, 16 January 2019 at 23:40:03 UTC, luckoverthere
wrote:
> Also a simpler work around to your problem:
>
> struct Expected(T, E) {
> private SumType!(T, E) data;
> @property T value() {
> return data.match!(
> (T val) => val,
> (E err) { throw new Exception(err.to!string);
> return T.init; }
> );
> }
> }
Yes, this would also work. But having to insert a spurious return
statement just to placate the type system is still unsatisfactory
compared to the original version. In fact, it's the exact sort of
special-case hackery that Walter expressed concern about in his
post.
More information about the Digitalmars-d
mailing list