Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
masklinn
on Oct 22, 2017
|
parent
|
context
|
favorite
| on:
Implementing Go's defer keyword in C++
On the other hand, it means any helper/builder has to handle this pattern on its own rather than be able to return a file object which can be "context managed" by a caller, which Python allows.
RX14
on Oct 22, 2017
[–]
True, but it's fairly easy to write:
def self.open File.open(...) { |f| yield f } end
Unless they need custom destructor actions, in which case presumably they'd have to implement that manually in python too.
masklinn
on Oct 22, 2017
|
parent
[–]
Yup and yup.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: