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.

Ask not what the compiler can do for you

100 pointsby manojr13about 2 years ago

10 comments

munificentabout 2 years ago
I don&#x27;t mean this to sound superior or critical.<p>I found this article a little surprising because the authors seem to have an intuition about the compiler that I have never had. I&#x27;ve never expected potential stack overflows from unbounded recursion to be caught by the compiler. I&#x27;ve been delighted every now and then when a compiler gives me a warning when it <i>can</i> detect it. But I have always had stack overflows in my mental bucket of &quot;stuff it&#x27;s my responsibility to think about&quot;.<p>Maybe this says something about how compilers have gotten smarter and more helpful since I first cut my teeth on them.
评论 #35834513 未加载
评论 #35831923 未加载
评论 #35834091 未加载
评论 #35832183 未加载
评论 #35833467 未加载
评论 #35834153 未加载
评论 #35834079 未加载
flooowabout 2 years ago
Fortunately this particular problem should go away soon. Async-fn-in-traits is due to be stabilized in the next few months [1], which means that the use of #[async_trait] will no longer be necessary, which means the compiler will correctly surface a warning for unbounded recursion.<p>[1] <a href="https:&#x2F;&#x2F;blog.rust-lang.org&#x2F;inside-rust&#x2F;2023&#x2F;05&#x2F;03&#x2F;stabilizing-async-fn-in-trait.html" rel="nofollow">https:&#x2F;&#x2F;blog.rust-lang.org&#x2F;inside-rust&#x2F;2023&#x2F;05&#x2F;03&#x2F;stabilizin...</a>
评论 #35835580 未加载
评论 #35835990 未加载
cat-whispererabout 2 years ago
I don&#x27;t fully understand the context or the overview of the problem, but for a large codebase, if you are using `tokio` runtime, which most rust based application go with. `tokio-console` is good for profiling and debugging, have you folks looked into that during the whole debugging process? I personally trust debuggers and debugging tools in such circumstances, as they can easily help zeroing down on such issues.
Nars088about 2 years ago
Is this the case with all statically typed languages? I think I have faced the same issue with PureScript<p>(PS: I&#x27;m a contributor)
评论 #35831024 未加载
pdimitarabout 2 years ago
Not sure rustc can do a lot about this case but maybe a static analysis tool can complement it.
评论 #35831664 未加载
评论 #35832028 未加载
thalaabout 2 years ago
Are there any tools to identify stack sizes and function traces?
评论 #35831992 未加载
Nars088about 2 years ago
We spent decades trying to invent a sufficiently smart compiler when we should have been inventing a sufficiently empathetic one - @ekuber<p>It all makes sense now
stefanos82about 2 years ago
Is there any flag in Rust&#x27;s compiler, like GCC&#x27;s `-fstack-check` that checks for such behavior?
评论 #35832598 未加载
nurettinabout 2 years ago
Is this what happens when we are too complicit and entirely depend on our tooling to find mistakes?
评论 #35833540 未加载
评论 #35834739 未加载
xiaodaiabout 2 years ago
ask what ChatGPT can do for you instead.