On Saturday, 7 October 2023 at 19:30:23 UTC, mw wrote:
On Saturday, 7 October 2023 at 19:25:51 UTC, mw wrote:
Or how can I get the `tag` and `storage` myself?

https://github.com/dlang/phobos/blob/a3f22129dd2a134338ca02b79ff0de242d7f016e/std/sumtype.d#L310


If I add this line to the above func `isF`:

```
  writeln(t.tag);
```

it won't compile:

sum_type.d(79): Error: no property `tag` for `t` of type `std.sumtype.SumType!(Fahrenheit, Celsius, Kelvin)`

Shouldn't the compiler error message be: t.tag is private? rather than "no property `tag` for `t`"?

The tag is stored there, why the programmer cannot inspect it, and get the payload?

Reply via email to