5 ms·
Nearly every modern language supports defer in some sense. Unless you are talking about RAII hiding the defer, but that's not the case with a custom Defer type
by bangaladore 2y ago
Nearly every modern language supports defer in some sense. Unless you are talking about RAII hiding the defer, but that's not the case with a custom Defer type or similar that takes a closure in the constructor.
Defer is a way better solution than having to cleanup in every single failure case.
- jefbyokyie 2y ago> cleanup in every single failure case you're only tempted to clean up [fully] in every single failure case if you don't know how to implement cascading gotos or the arrow pattern.
- bangaladore 2y agoI'll be honest that you are in the minority here. goto is widely considered an anti-pattern and so is the arrow pattern.
- jefbyokyie 2y ago> you are in the minority here Yes, I am.