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

You'd prefer explicit "with" clauses even for, say, reference counted types?

I mean, Objective-C tried explicit [foo release] for a long time, but I haven't heard anyone clamoring to go back to the pre-ARC world…




I mean "with" for opens and the like, not structures. Python "with", not Pascal "with".

For Python's "with", someone figured out what to do if something goes wrong in __exit__, which is called as control leaves the with clause. An exception in an __exit__ is handled well, and nested exceptions work reasonably. Failure to get this right results in problems such as unnoticed truncated files because the status on the close after a write wasn't checked.


Right, I'm referring to Python's "with". How do you write reference counted smart pointers without RAII?




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

Search: