3 ms·
You could assert a limit on depth, perhaps. Then the cycle would still exist but after X number of comments, the rendering ends.
by petercooper 14y ago
You could assert a limit on depth, perhaps. Then the cycle would still exist but after X number of comments, the rendering ends.
- timothya 14y agoThis is a reasonable solution. While it will (almost) never provide the correct result (it might print out a cycle of comments until X is reached, or it might cut off a very long but legitimate comment thread), it would provide a reasonable guarantee on this sort of problem not generating infinite pages.
- petercooper 14y agoAt the risk of being accused of flame-baiting, I'd say it's the engineering solution rather than the mathematical one.. ;-) For some reason I tend to be a fan of the "stick it in a secure box" rather than "get it right in the first place" approach..