Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Destroy all values: Designing deinitialization in programming languages (gankra.github.io)
4 points by littlestymaar on Feb 3, 2022 | hide | past | favorite | 1 comment


I don't think I've ever used a programming language that didn't say somewhere in the documentation that destructors were a broken feature that you shouldn't really used.

Practically the best kind of finalization mechanism seems to be the try-finally block, with and similar kinds of structure that are tied to some execution scope. On the other hand there are more dynamic situations where you really need a variable lifetime and there isn't a great answer for that other than building some manual 'teardown' infrastructure as is necessary if you want to build parallel processing pipelines with Java's Executors that always give the right answers.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: