Re:Tail Call Optimization: The Musical
by neilv on Sunday January 08, 2023 @07:41AM
(#34298617)
One thing to add: It's idiomatic for Scheme (or Racket) code to use tail calls in places that would be unnecessary and inappropriate in many languages.
This can combine with other language features and idioms, to get effects such as (in addition to what soegaard mentioned) reducing mutations, and avoiding `return` exits. Which can increase the readability/maintainability -- and therefore correctness -- of the code.
So some suggest that Tail Call Optimization for Scheme should instead be called Proper Implementation of Tail Calls.
This can combine with other language features and idioms, to get effects such as (in addition to what soegaard mentioned) reducing mutations, and avoiding `return` exits. Which can increase the readability/maintainability -- and therefore correctness -- of the code.
So some suggest that Tail Call Optimization for Scheme should instead be called Proper Implementation of Tail Calls.