Perl needs modern garbage collection
13 Sep 2012
Chromatic just wrote a list of important features that Perl 5 needs. While I agree with most of the listed ones (and in fact contributed to the new p5-mop proposal during the recent Hackathon), I found one feature curiously missing.
I mean, JWZ pointed this out in 1998; Perl garbage collection is a bad joke
. That was 14 years ago, and the situation is the same. It is trivial to create a circular reference and trip it up. Especially when you are doing evented code where callbacks are common, it is quite easy to close over some variable and create a leak. Languages like C#, Ruby and Java has this sorted already with variants of mark and sweep-based systems, Python has built in cycle detectors in their ref count implementation, and even Objective-C manages to detect cycles fairly well with their new compile-time automated reference counting.
Don't worry so much about adding sugar to the syntax. This is a feature Perl really needs.