Re:PHP finally gets finally
by ExpiredLink on Monday August 13, 2012 @12:14PM
(#4376575)
PHP has no destructors?
[ Parent
| on HN ]
How did you get that information from this post? PHP has had destructors in some form since 4.x, and true class destructors in 5.x: http://php.net/manual/en/language.oop5.decon.php
My guess is he's from the C++ camp who tend to always suggest RAII as a replacement for 'finally' and RAII relies upon destructors.
Destructors aren't a good way to free resources in a garbage collected language.
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?
Have you heard about Racket's custodians?
[1] http://docs.racket-lang.org/reference/eval-model.html#(part....
Re:PHP finally gets finally
by true_religion on Monday August 13, 2012 @04:04PM
(#4377832)
Does ref-counting count as garbage collection?