TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Atypical returns with the (no) return statement

1 点作者 AtypecastA9 个月前
I figuered out branch prediction is something out of predictability of a real software engineer working on top of a compiler in a higher level language... And I remembered Bill Gates writing self modifing code in the early MS-DOS days ...<p>Is it worthwile to introduce the (no) return statement in C++, Java, JavaScript and Kotlin with the following semantics:<p>(no) return; &#x2F;&#x2F; pulls the top stack frame<p>(no) return all; &#x2F;&#x2F; proceeds right after a call into recursion<p>(no) return 5; &#x2F;&#x2F; pulls al frames such as the next return will jump to the fifth frame<p>(no) return -7; &#x2F;&#x2F; pulls seven stack frames<p>Thanks a lot, community!<p>I enjoy ever visit and gained a lot of insight into my profession and beyond from all of you. Thank you very much.<p>&lt;typecast&gt;

1 comment

gus_massa9 个月前
I&#x27;m not sure what you want, but Racket&#x2F;Scheme (and perhaps Clojure) have continuations that can be used for something similar [1]. Perhaps you need continuation marks and advanced macrology, that I&#x27;m afraid of.<p>&gt; <i>(no) return all; &#x2F;&#x2F; proceeds right after a call into recursion</i><p>What about f -&gt; g -&gt; f -&gt; g -&gt; f -&gt; g -&gt; f -&gt; g -&gt; f ?<p>And f -&gt; g -&gt; f -&gt; g -&gt; f -&gt; X -&gt; f -&gt; g -&gt; f -&gt; g -&gt; f ?<p>[1] <a href="https:&#x2F;&#x2F;docs.racket-lang.org&#x2F;guide&#x2F;conts.html" rel="nofollow">https:&#x2F;&#x2F;docs.racket-lang.org&#x2F;guide&#x2F;conts.html</a>