Re:Austral Programming Language
by fpoling on Friday July 28, 2023 @02:13AM
(#36903548)
To statically ensure a stack overflow does not happen requires that recursion is rejected by the type system. Austral does not do that so the stack overflow is a dynamic condition similar to memory allocation failures.
[ Parent
| on HN ]
Re:Austral Programming Language
by JonChesterfield on Friday July 28, 2023 @05:05AM
(#36904505)
Maximum stack usage can be calculated in the presence of recursion. Tail calls can be handled as branches instead of nested call frames, but also non-tail calls are tolerable if you have (or can infer) some measure to determine maximum call stack depth.
It's a pain, and the type system rejecting any recursion is certainly simpler, but that's not a strict requirement.
Inferring the number of loop integrations or recursion levels is in practice impossible when the number depends on the user input.
For a system language I would like to see that when the compiler cannot infer the bound on the stack size or when that static bound exceeds some static limit, a function call is treated as fallible.