4 ms·
"Some features of the Plankalkül:[22] ... functions do not support recursion" That's not a feature, that's a bug.
by soperj 4y ago
"Some features of the Plankalkül:[22]
...
functions do not support recursion"
That's not a feature, that's a bug.
- egormakarov 4y agoMISRA-ready!
- kibwen 4y agoWhat 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.
- ho_schi 4y agoMISRA-C likes this.
- foepys 4y agoSince every recursive program can be implemented without recursion, this isn't really a limitation. Recursion can actually be a pit fall if you parse user generated data and don't set recursion limits. If feasible I try to avoid recursion.
- macintux 4y ago> Since every recursive program can be implemented without recursion… Depends on the programming language, obviously. In Erlang, e.g., recursion is your looping construct, and everything is ultimately a loop.
- farhaven 4y agoI think that's "feature" as in "property", not "feature" as in "good thing to put in an ad for this". Edit: if it somehow supports passing functions (or function pointers) as parameters, the Y combinator can be used to add recursion even if it's not natively supported otherwise.