How to initialize immutable variables with an expression that throws an exception to catch?
Max Samukha
maxsamukha at gmail.com
Tue Apr 7 20:11:29 UTC 2020
On Tuesday, 7 April 2020 at 19:52:36 UTC, tsbockman wrote:
> On Tuesday, 7 April 2020 at 14:15:20 UTC, FeepingCreature wrote:
>> 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?
>
> The problem in the language is that immutability is considered
> a permanent and fundamental property of a value, whereas it is
> actually a state that is entered after the
> initialization/construction of the value is complete, and
> exited when the value's memory is later reclaimed.
>
Exactly (with a small correction that the state is exited before
the destruction if there is any)!
More information about the Digitalmars-d
mailing list