News for hackers. Stuff that matters.
Re:Implementing Go's defer keyword in C++ by lstyls on Saturday October 21, 2017 @08:13PM (#15524363)
I know Python far better than Ruby, but it looks like the semantics are equivalent, it's just that Ruby's standard `open` implementation includes the cleanup rather than leaving it up to the caller as in Python.
Re:Implementing Go's defer keyword in C++ by masklinn on Sunday October 22, 2017 @06:23AM (#15526032)
One difference is that Ruby does not need a special language construct/protocol to do so.

An other is that Python's "context managers" are reified which means you can pass them around until you ultimately use them. It's a tradeoff.