Try blocks are trying
FeepingCreature
feepingcreature at gmail.com
Mon Oct 11 13:29:42 UTC 2021
On Monday, 11 October 2021 at 12:20:11 UTC, bauss wrote:
> Yeah, I'm aware it's not necessarily "immutable" in the
> standard sense, but it is in the technical sense.
>
> Of course the export try would be much better but this is a
> somewhat viable solution until, as you can easily replace it
> with immutable once/if ever supported.
No I mean:
```
struct Problem
{
immutable int value;
}
Problem getNumber(int input)
{
if (input == 0) throw new Exception("This function doesn't
allow multiplications of zero.");
return Problem(input * 2);
}
```
And it errors out.
Types like these are a crapshoot in D2 even now.
More information about the Digitalmars-d
mailing list