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

> The minimum available stack space is a known quantity.

It is. Tracking and erroring out on it to avoid the exception means replicating your runtime environment's mechanism for tracking and erroring out on stack overflow (system in a system / inner platform anti-pattern). Your runtime environment's implementors know that, so it's unlikely you'll find the APIs necessary to avoid an exception (i.e. a maxRecursion param and equivalent error result).

> Exceeding it means you made a mistake.

No, it can be just a part of processing a request. Depending on the particular runtime environment, it does not have any impact on other parts of the process.



> so it's unlikely you'll find the APIs necessary to avoid an exception

Lacking a needed API is programmer error. Better programming can avoid that kind of exception. A hypothetical, sufficient smart compiler could fail at compile time, warning you are missing code to handle certain states in the absence of such an API.

To reiterate, exceptions are faults which come as a result of incorrect programs. Errors are faults which come as a result of external conditions. A program that overflows the stack is an incorrect program. The stack size is known in advance. If it is overflown, a programmer didn't do proper accounting and due diligence.


> Lacking a needed API is programmer error.

Whoa, easy there. We're talking about standard libraries, and the designers of those are not complete morons. The API is lacking because the runtime environment already provides a safe and defined environment for the observed behavior. It just happens to not fit your mental model, which I find too strict and off wrt reality on one hand, and infeasible on the other (Gödel wants to have a talk with you).


Don't let perfect be the enemy of good. It is quite pragmatic to make such an error.

We're ultimately talking about engineering here. Engineering is all about picking your battles and accepting tradeoffs. You go into it knowing that you will have to settle on making some mistakes. Creating an ideal world is infeasible.

Indeed, it is your mental model that is too strict. To err is fine. To err is human!




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

Search: