Why do immutable variables need reference counting?
ag0aep6g
anonymous at example.com
Sun Apr 17 14:09:12 UTC 2022
On 17.04.22 15:06, wjoe wrote:
> On the matter of undefined behavior. Technically a program is in
> undefined behavior land after throwing an error, thus every unittest
> that continues after assertThrown is therefore nonsense code, is it not ?
Yes.
Failing asserts are a messy part of the language. They are supposed to be:
1) not catchable, because they indicate a bug in the program;
2) catchable in order to be testable;
3) assumed impossible for optimization purposes.
Those goals are at odds with each other, and I don't think the spec
manages to consolidate them.
But mutating `immutable` data is not messy. It's simply not allowed.
More information about the Digitalmars-d-learn
mailing list