3 ms·
I have never seen this referred to anything other than things like tail-call recursion, tail-call optimization, etc. Languages like Python make implementing si
by bmitc 5y ago
I have never seen this referred to anything other than things like tail-call recursion, tail-call optimization, etc.
Languages like Python make implementing simple loops like:
def loop():
<whatever>
loop()
impossible.
Python will reach a maximum recursion depth and error.
Why is this important? Like I said, it makes looping very easy. For example, actors can almost be trivially implementing in languages with tail-call recursion.
It’s not in Python because like most things in Python, van Rossum doesn’t like it because <reasons>.
https://stackoverflow.com/questions/13591970/does-python-optimize-tail-recursion https://stackoverflow.com/questions/13591970/does-python-opt...
There’s little point in having full traces of the data doing in and out of the tail-call loop is immutable, so you only really care about the current call of the function.
- Terry_Roll 5y ago<goes away to find out what if its in my preferred language & tool> Its not something I've every heard of before, I guess its peculiar to Python though but dont most languages have some eccentricity?
- travv0 5y agoIt's absolutely not peculiar to Python, it's something that every single language implementation has to make a decision on one way or the other. Here's an SO answer from 2008 about how to enable TCO in various C and C++ compilers: https://stackoverflow.com/questions/34125/which-if-any-c-compilers-do-tail-recursion-optimization https://stackoverflow.com/questions/34125/which-if-any-c-com... There are many things both you and I have never heard of before. That's normal.