When i lern a new language i implement factorial in recursive just for fun.
But i just noticed something: in Python 3.5 64 bit, the biggest factorial i can calculate before maximum recursive length is 988!.
But in Pharo 5.0 32 bit i just calculated 100000! recursively.
That seems like a to big of a difference to be explained by efficiency of the code/language.
@turi looks like it's a purposeful guard to avoid stack overflows.
@turi i'd imagine it's more a matter of a failsafe...ensuring that you get an exception you can catch, handle, and log, rather than just letting the interpreter crash. 1000 is plenty for most programs, and if you need more than that, you can explicitly up the limit.
@turi yah. it sounds like pharo doesn't use a stack at all (at least it's execution model doesn't assume it?). neat.
@rascalking Yes i guess so.
Pharo on the other hand has NO limits at all. In fact, the standard implementation of factorial is recursively and faster than the iterative implementation.
Quite the difference in approach.