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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Rusthon – A Pythonic language that compiles to Rust and C++

139 点作者 doublextremevil超过 10 年前

10 条评论

Demiurge超过 10 年前
As I&#x27;m sure everyone, I was wondering, why... If you follow through from the top to the blog, there is authors reasoning:<p><i>Introducing Rusthon<p>Rust is a systems programming language, and too low level for quick prototyping, or simple web backends. It is nice to have all of the low level control so you can fine tune performance later, but it should be optional. Rusthon is a high level Python-like language that compiles to Rust. Rusthon started as a fork of Gython, which is a fork of PythonJS.<p>The goal of Rusthon is simple and clean syntax inspired by Python. Rusthon will allow you to code at a higher level than normal Rust code, and interoperate well with hand written Rust and the Rust libraries. You can start off writting your application in Rusthon, and drop down to hand written Rust where you need more performance.</i><p><a href="http://rusthon-lang.blogspot.com/" rel="nofollow">http:&#x2F;&#x2F;rusthon-lang.blogspot.com&#x2F;</a>
haberman超过 10 年前
Compiling to Rust is a really interesting proposition, because it means the resulting program has the same safe-without-gc properties as native Rust programs.
评论 #8781485 未加载
Matthias247超过 10 年前
Does this care about memory at all? In the transpiled code I see structures getting allocated but never deallocated.<p>That will work for this trivial examples, but not for anything serious.<p>To properly translate Python to C++ you would have atleast produce a <i>shared_ptr&lt;T&gt;</i> from every <i>T</i> and even that doesn&#x27;t work with cycles. Rust translation is even more complicated.
评论 #8783410 未加载
sdfjkl超过 10 年前
Reminds me of Nim (formerly Nimrod): <a href="http://nim-lang.org/" rel="nofollow">http:&#x2F;&#x2F;nim-lang.org&#x2F;</a>
评论 #8781478 未加载
duey超过 10 年前
Why would you use this over LLVM? e.g. pyston (LLVM Python) and then using llc -march=rustc&#x2F;c&#x2F;cpp&#x2F;whatever to convert?
评论 #8781481 未加载
评论 #8781475 未加载
amit_m超过 10 年前
Cython already compiles to C and is relatively mature.<p>In my opinion these hacks will always be specialty tools. What the world really needs is more languages that are both expressive and run pretty fast. e.g. Julia.
评论 #8781492 未加载
评论 #8781490 未加载
评论 #8781494 未加载
andywood超过 10 年前
Some comments here suggest the possibility of making manual changes to the Rust code. After cross compiling, how does one make changes to the Rust code, then go back and make changes to the Python code, and cross compile again without losing the customized Rust code?
jumanji超过 10 年前
<a href="https://github.com/rusthon/Rusthon/blob/master/pythonjs/translator.py#L32" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;rusthon&#x2F;Rusthon&#x2F;blob&#x2F;master&#x2F;pythonjs&#x2F;tran...</a><p>if &#x27;--cpp&#x27; [...] rust=True<p>Is that a bug?
评论 #8782065 未加载
评论 #8781483 未加载
chenzhekl超过 10 年前
It would be great if it can interoperate seamlessly with existed C++ library.
lago超过 10 年前
<p><pre><code> # naming fix :) mv Rusthon Pythrust</code></pre>