How to initialize immutable variables with an expression that throws an exception to catch?
FeepingCreature
feepingcreature at gmail.com
Tue Apr 7 14:15:20 UTC 2020
On Friday, 3 April 2020 at 15:43:51 UTC, Ali Çehreli wrote:
> On 4/2/20 11:56 PM, FeepingCreature wrote:
>
>> The only way I've found is to make fun() return Algebraic!(S,
>> Exception) but that's kind of ugly and bypasses a basic
>> language feature.
>
> How about using a Nullable!(immutable(S)):
>
> [snip]
Right, but that's still the exact same workaround, except with
Nullable instead of Algebraic. I know how to work around it. I'm
saying what should be changed in the language so I don't *have
to* work around it?
More information about the Digitalmars-d
mailing list