r/ProgrammingLanguages • Futhark • Jan 20 '26

Why not tail recursion?

https://futhark-lang.org/blog/2026-01-20-why-not-tail-recursion.html
62 Upvotes

34 comments sorted by

View all comments

Show parent comment

1

u/jsshapiro Jan 22 '26

Yes. In fact, this is one of the pragmatic reasons that most functional languages require all functions to have exactly one argument. This reduces all functions to a single register plus an entry label and a continuation register, which is what allows function call to be implemented by jump and function return to be implemented by jump through register. There are some cases where the entry label has to be handled via register as well (for dynamic dispatch).

There are reasons for this approach to functions from a formal perspective as well, But I've probably wasted everybody's time on formal specification enough for one week.:-)