Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> We have a list of phrases that get replaced in titles and their replacements (which can be the empty string if we simply want to remove something). A moderator accidentally added an identical pair to it.

This should prove once and forever that tail recursion is dangerous and does not help with real world problems. Clearly, blowing up the stack would have been the appropriate and safer response here.



Yeah, that would replace an infinite loop with a stack overflow in that specific case, but I'm not sure that all infinite loop bugs can be converted to stack overflow bugs in the general case. Another commenter's suggestion to "have tests and a staging environment" makes more sense to me.


I think you mean that TCO is dangerous. Besides, this is probably more of an implementation problem. Do you really want to be applying a filter like this multiple times?

If I had to implement this, I would just imagine that just taking your mapping, and for each key,value , do a title.replace(key,value). I would be a "good enough" solution , and in the worst case you still have human editors on HN.


If you have one wordfilter to map "!"->"" and another to replace "cunt"->"asdf" and you got the input "cu!nt" what should the output be?


Interestingly, distinguishing between "non-loopy" and "potentially loopy" sets of rewrite rules seems to be equivalent to the halting problem :-( The key phrase would be "tag systems".


I'm not sure I particularly care so long as it produces some output before the heat death of the universe.


good point. I understood this to be more of a counter to non-malicious intent than otherwise.


Sorry, this is uneducated bullshit. There was a infinite loop and that was a error in programming logic. Limiting loops a certain number of iterations is absolute bogus. Ever though how stupid it sounds to demand c to forbid while(1)?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: