TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Infinite Recursion

59 pointsby luccasteraover 15 years ago

3 comments

Periodicover 15 years ago
This had me laughing out loud:<p>"The same mistake is done on the Computer Language Benchmark Game. There's an Array sorting benchmark where Haskell just blows away even hand-optimized C. The secret is that the benchmark never prints out the contents of the sorted array. The C compiler isn't smart enough to recognize that the array is never actually used anywhere, but Haskell is, and so the entire benchmark basically compiles down to the equivalent of "int main() { return 0; }"."
yangyangover 15 years ago
He forgot C! It's not in the language spec, but gcc will optimize tail calls, with -O2 or above.
amichailover 15 years ago
From: <a href="http://stronglytypedblog.blogspot.com/2009/08/scala-tail-recursion.html" rel="nofollow">http://stronglytypedblog.blogspot.com/2009/08/scala-tail-rec...</a><p><i>If the recursion is indirect, for example, Scala cannot optimize tail calls, because of the limited JVM instruction set.</i><p>Why is that?
评论 #803818 未加载