有人尝试过水晶编程语言(机器代码编译的Ruby)吗?

时间:2022-07-15 03:15:13

Like many others, I always hold true that "A pure compiler will never exist for Ruby because the language is far too dynamic for a static compiler to work."

和其他许多人一样,我始终认为“纯编译器对于Ruby来说永远都不会存在,因为对于静态编译器来说,语言太过动态了。”

But I recently stumbled upon these:

但我最近偶然发现了这些:

The Crystal programming language at GitHub

GitHub上的水晶编程语言

Statically compiled Ruby

静态编译Ruby

Both projects seem to be very interesting. They could give us the speed of a native-compiled language (and the often commercially-required, obfuscated code of a compiled language) while keeping all (or most) of the elegance and flexibility of Ruby. Add a good support library (or, more likely, the possibility to access the existing C++ libraries) and you can easily understand why this stuff could be interesting.

这两个项目看起来都很有趣。它们可以为我们提供本地编译语言的速度(以及通常商业需要的、编译语言的混淆代码),同时保持Ruby的所有(或大部分)优雅和灵活性。添加一个好的支持库(或者更有可能是访问现有c++库的可能性),您就可以很容易地理解为什么这些东西会很有趣。

Has anybody tried the Crystal language? (I didn't yet, because of compilation problems with ruby-llvm)

有人尝试过水晶语言吗?(我还没有,因为ruby-llvm的编译问题)

Which was his/her feeling about it?

他/她对此有何感想?

Do you think that, given those design choices, would it be actually possible to develop a native-code (machine-code) compiler for Ruby (with a reasonable effort and in a reasonable amount of time)? Would it be meaningful?

您认为,考虑到这些设计选择,为Ruby开发一个本机代码(机器代码)编译器(需要合理的努力和合理的时间)真的可能吗?是有意义的吗?

2 个解决方案

#1


41  

I'm the developer of crystal. Currently not everything is implemented from the bulleted point list. In fact classes were just started to be implemented.

我是水晶的开发者。目前并不是所有的东西都是从项目符号列表中实现的。实际上,类刚刚开始实现。

I really like the idea of it though. But I need to think more about how to implement it. And I also need more time, hehe.

我真的很喜欢这个主意。但我需要更多地考虑如何实现它。我也需要更多的时间,呵呵。

The second article has a completely different approach because it won't introduce a new language: it'll just try to compile a subset of Ruby, or maybe will be compiled to native code but still allow some dynamism with performance costs (I talked to the author of that article some months ago).

第二篇文章有一个完全不同的方法,因为它不会引入新的语言:它会尝试编译Ruby的一个子集,或者将编译为本地代码,但仍允许一些活力与性能成本(我和这篇文章的作者几个月前)。

My feeling toward both approaches: I really with it could happen. We need a fast language with an elegant, readable, joy to use syntax and library (like what Ruby offers).

我对两种方法的感觉是:我真的有可能发生。我们需要一种具有优雅、易读、使用语法和库(就像Ruby提供的那样)的快速语言。

#2


12  

I'm the developer of Foundry; the second article is mine.

我是铸造公司的开发人员;第二篇文章是我的。

A more recent article on the same topic would be "A language for embedded developers"; or you could also track development progress by subscribing at foundry-lang.org.

最近关于同一主题的一篇文章将是“嵌入式开发人员的语言”;或者你也可以通过订阅foundry-lang.org来跟踪开发进度。

Please note, however, that my project is commercial, (at least initially) not open-source, and is primarily focused on embedded development. You could still use it on desktops or servers, of course.

但是请注意,我的项目是商业的(至少最初)不是开源的,并且主要关注嵌入式开发。当然,您仍然可以在桌面或服务器上使用它。

I'm also one of ruby-llvm maintainers; please report the problems you've encountered as bugs on the project page.

我也是ruby-llvm维护人员之一;请报告您在项目页面上遇到的bug。

#1


41  

I'm the developer of crystal. Currently not everything is implemented from the bulleted point list. In fact classes were just started to be implemented.

我是水晶的开发者。目前并不是所有的东西都是从项目符号列表中实现的。实际上,类刚刚开始实现。

I really like the idea of it though. But I need to think more about how to implement it. And I also need more time, hehe.

我真的很喜欢这个主意。但我需要更多地考虑如何实现它。我也需要更多的时间,呵呵。

The second article has a completely different approach because it won't introduce a new language: it'll just try to compile a subset of Ruby, or maybe will be compiled to native code but still allow some dynamism with performance costs (I talked to the author of that article some months ago).

第二篇文章有一个完全不同的方法,因为它不会引入新的语言:它会尝试编译Ruby的一个子集,或者将编译为本地代码,但仍允许一些活力与性能成本(我和这篇文章的作者几个月前)。

My feeling toward both approaches: I really with it could happen. We need a fast language with an elegant, readable, joy to use syntax and library (like what Ruby offers).

我对两种方法的感觉是:我真的有可能发生。我们需要一种具有优雅、易读、使用语法和库(就像Ruby提供的那样)的快速语言。

#2


12  

I'm the developer of Foundry; the second article is mine.

我是铸造公司的开发人员;第二篇文章是我的。

A more recent article on the same topic would be "A language for embedded developers"; or you could also track development progress by subscribing at foundry-lang.org.

最近关于同一主题的一篇文章将是“嵌入式开发人员的语言”;或者你也可以通过订阅foundry-lang.org来跟踪开发进度。

Please note, however, that my project is commercial, (at least initially) not open-source, and is primarily focused on embedded development. You could still use it on desktops or servers, of course.

但是请注意,我的项目是商业的(至少最初)不是开源的,并且主要关注嵌入式开发。当然,您仍然可以在桌面或服务器上使用它。

I'm also one of ruby-llvm maintainers; please report the problems you've encountered as bugs on the project page.

我也是ruby-llvm维护人员之一;请报告您在项目页面上遇到的bug。