3 ms·
"People seem to think that writing a garbage collector is really hard [...] Well it's not. In fact, it's rather straight forward." [...] "Thirdly. Please don
by doty 12y ago
"People seem to think that writing a garbage collector is really hard [...] Well it's not. In fact, it's rather straight forward."
[...]
"Thirdly. Please don't use this code. I did not intend for it to be wholly correct and there may be subtle bugs I did not catch."
- scorpioxy 12y agoI am not sure what you're pointing at. I think this article aims to do the same as any other "compiler for a toy language" article; namely remove the fear barrier and explain that at their core, many of our black boxes utilize simple concepts. I've always thought a compiler was difficult to write until I wrote my first one. Sure it is nothing when compared to a production-level compiler but definitely no longer think that there's something magical about compilers, even the more advanced ones.
- wtetzner 12y agoYeah, and this is true of webapps (and many other kinds of programs) as well. Writing a webapp is (or at least can be) easy, but writing a production qualiy webapp isn't.
- doty 12y agoI'm sure that I don't need to tell you that there are many things in this world that look easy, but are in fact very hard. Even things that are very simple at the core turn out to be very difficult in practice. I mean, to be a little flippant, all you need is abstraction and application, and you can compute all computable problems, right? More to the point: what I was trying to do was to point out the irony of saying "building a garbage collector is easy" and then, only a few sentences later, saying "this code may have subtle bugs." Saying "this code is not fast enough for production" would be one thing, saying "this code is not correct" seems to put lie to the assertion that building it is "easy." I personally have never built a garbage collector in anger. But I suspect that the problem of building a passable garbage collector (that is, one that somebody else would be willing to use) is quite a bit harder than it is made out to be in this article.
- scott_s 12y agoThe point of this post is education. The author is trying to de-mystify garbage collectors. His approach - which I think is a good one - is to present code that is quite simple, but still meets the criteria for being a garbage collector. This is a pedagogical technique. Your points are valid, but they also ignore that the author is trying to teach concepts through code. That often require simplification.