3 ms·
What mechanism does it use to prevent recursion? To even raise the question seems to imply that it supports function calls, and it's easy for recursion to just
by kibwen 4y ago
What mechanism does it use to prevent recursion? To even raise the question seems to imply that it supports function calls, and it's easy for recursion to just kind of happen unless there's a specific implementation detail that prevents it. For example, maybe instead of a growable function stack, every function has dedicated stack space allocated up front, and recursive calls would scribble over the local variables of calls higher in the stack?
- shash 4y agoI know that at least LabVIEW (which is otherwise Turing complete) will throw a compiler error when you try to call a function anywhere within its own code. Actually, being a graphical language with hardly a difference between “function”, “module” and “user interface”, it’s a bit more involved, but it goes through some length to make sure it’s non-trivial without resorting to something like shell scripting to make a recursive call. It doesn’t really have any dynamic programming capabilities as far as I know so a static analysis is probably enough for the compiler. Apparently recursion was deemed “too confusing”… On the other hand, it sounds like Plankakül was more of an intellectual exercise than an implementation, so we don’t know how much extant implementations comply with that spec…
- guenthert 4y agoNot supporting a feature doesn't mean actively preventing you from attempting to use it. It might just have not given the expected result. > To even raise the question seems to imply that it supports function calls Yes, but it doesn't imply a stack or support for reentrance. If the language supports only global (pre-allocated) variables like early versions of FORTRAN and BASIC, then there's no allowance for recursion.
- imtringued 4y agoCome on, it is most likely simpler than that. There is no stack, all variables are allocated statically.