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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Polycompiler: Merge Python and JavaScript code into one file that runs in both

66 点作者 nickoates5 天前

4 条评论

mmastrac大约 21 小时前
I&#x27;ll raise you a polyglot script that doesn&#x27;t require eval: :)<p><pre><code> 1 &#x2F;&#x2F; len(&quot;&quot;&quot; console.log(&#x27;javascript&#x27;); &#x2F;* &quot;&quot;&quot;) print(&#x27;python&#x27;); # *&#x2F; </code></pre> Example:<p><pre><code> # python3 &#x2F;tmp&#x2F;test.py python # node &#x2F;tmp&#x2F;test.js javascript </code></pre> I _believe_ the only source limitations are the the JS cannot contain `&quot;&quot;&quot;` and Python cannot contain `*&#x2F;`.
评论 #43925951 未加载
taraparo1 天前
You could also write your app in Haxe instead and cross compile to Javascript, Python, C++, Java, Lua,...
评论 #43919636 未加载
评论 #43918392 未加载
评论 #43920004 未加载
gobblik1 天前
The tricks it uses are explained well in the video. Would love to see this expand to include more languages.
GeekFortyTwo1 天前
Ok, now write your code in a metalanguage(i believe fut might work), and now we can write once and run on two different engines.
评论 #43917334 未加载