▲ | almostgotcaught 2 days ago | ||||||||||||||||
> Invariants are functions that run at the start and end of every public member function these are just runtime assertions EDIT: how am i getting downvoted for copy-pasting literally what the article verifies? | |||||||||||||||||
▲ | LorenDB 2 days ago | parent | next [-] | ||||||||||||||||
Yes, but they are guaranteed to run at the beginning and end. C/C++ asserts need to handle any return path, whereas D has functionality to mark statements to run at the end of any return path while only being written once. See also the scope(exit) feature. | |||||||||||||||||
| |||||||||||||||||
▲ | jayd16 2 days ago | parent | prev | next [-] | ||||||||||||||||
I think there's something to be said about them running automatically that is lost when you say they're just asserts. | |||||||||||||||||
| |||||||||||||||||
▲ | readthenotes1 2 days ago | parent | prev [-] | ||||||||||||||||
Maybe it's the editorial "just"? Like: software programs can't be that difficult to create properly because they are just 1s and 0s. | |||||||||||||||||
|