Hacker News new | past | comments | ask | show | jobs | submit login

Wait, the moment a creator function returns its created values, it is also returning their ownership. So at least with that concrete DRY refactor you are showing, you're effectively not only moving code but also responsibilities around.

But I get your point: with destructors you are free to change the ownership responsibilities, because the link between a variable and its releasing is implicit and carried over by the runtime, instead of explicitly being cared for by the code.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: