logoalt Hacker News

cma01/22/20251 replyview on HN

Can constructors and destructors still go counter to this idea if needed?


Replies

sunshowers01/22/2025

I think values should generally only be combined into a structure at the end (no half-formed structures with null data, no calls on methods that work on half-formed structures).

Destructors are more complicated, there's definitely times where you have to violate invariants that otherwise are always the case.