Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
ohnoesjmr
on Oct 22, 2017
|
parent
|
context
|
favorite
| on:
Implementing Go's defer keyword in C++
The problem with contexts is that can't just innocently enter one in some if branch where the rest of the code would be scoped.
I ended up an OnExit() context that does:
if conn is not None: ctx.call(conn.close)
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search:
I ended up an OnExit() context that does: