This is an exciting step forward for being able to prevent repetitious code and handle exceptions more elegantly. More excitement will be had when we actually see this implemented in an upcoming version.
In case you are wondering why this link goes to the bottom of the page, the important bit is:
2012/08/13 Xinchen Hui: Close voting, RFC win the voting
The RFC is a bit dry and does explain some use cases, however, GoogleGuy (who is a really nice and helpful guy in the ##php channel) provided a wonderful explanation[1] that goes into more detail.
Accepting the RFC is just the first step, let's hope we can see this in the next version.
C++ has a finally equivalent in a different form: Every object gets to clean up at the end of the scope as part of it's destructor. If you're not using RAII to manage cleaning up resources at the end of a scope, it's probably a good idea to change your style a bit.
It is definitely great. Although missed this for quite some years now, it is quite pleasing to see how the language continue to evolve throughout the years :)
The first use-case for finally involved locking database tables, and then unlocking them in the finally clause. It would be pretty bad, if you could not guarantee the unlock would happen. So one would hope that has been properly taken care of :-)
I have yet to see a language that actually cleans up after itself. Many will attempt to free memory, but what about files, db connections, windows, sockets?
In case you are wondering why this link goes to the bottom of the page, the important bit is:
2012/08/13 Xinchen Hui: Close voting, RFC win the voting
The RFC is a bit dry and does explain some use cases, however, GoogleGuy (who is a really nice and helpful guy in the ##php channel) provided a wonderful explanation[1] that goes into more detail.
Accepting the RFC is just the first step, let's hope we can see this in the next version.
[1] - http://sheriframadan.com/2012/08/finally-keyword-in-php/