▲ | kazinator 4 days ago | ||||||||||||||||
> If you want to make sure the value doesn't disappear, you shouldn't be using conditional assignment in the first place. If it worked using "materialize-on-write" semantics, why wouldn't you, as an alternative to the verbose code which checks every path component that might not exist, and instantiates it before doing the assignment? Obviously, you can't use it if you don't have materialize-on-write semantics in the assigned expression not that you shouldn't. | |||||||||||||||||
▲ | Dylan16807 4 days ago | parent [-] | ||||||||||||||||
If it materialized instead, yeah that sentence wouldn't apply the same way. But materializing with a default constructor opens up many cans of worms. I would say it has significantly more downsides than short circuiting. Also it should use a different operator. | |||||||||||||||||
|