2 ms·
You still have to implement the inverse of the arbitrary operation, at some point, somehow. A programming language can't figure out what the inverse of open()
by skrebbel 15y ago
You still have to implement the inverse of the arbitrary operation, at some point, somehow.
A programming language can't figure out what the inverse of open() is without someone somewhere telling it to close(). The point of the idiom is to have a library figure that out so that users don't have to. Therefore, Ruby supports it fully (there where API developers are sane, that is).
- silentbicycle 15y agoHaving that built in for every side-effect in the language is pretty amazing, though. Case by case, the block scoping idiom is a good way to handle it.