有人尝试过 Crystal 编程语言(机器代码编译的 Ruby)吗? [英] Anybody tried the Crystal Programming Language (machine-code compiled Ruby)?

查看:48
本文介绍了有人尝试过 Crystal 编程语言(机器代码编译的 Ruby)吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

像许多其他人一样,我始终坚信Ruby 永远不会存在纯编译器,因为该语言过于动态,静态编译器无法工作."

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."

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

But I recently stumbled upon these:

GitHub 上的 Crystal 编程语言

静态编译的 Ruby

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

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​​-llvm 的编译问题)

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

他/她对此有何感受?

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

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?

推荐答案

我是 Crystal 的开发者.目前并非所有内容都从项目符号列表中实现.事实上,类才刚刚开始实施.

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.

第二篇文章有一个完全不同的方法,因为它不会引入一种新语言:它只会尝试编译 Ruby 的一个子集,或者可能会被编译为本机代码但仍然允许一些动态性能成本(几个月前我和那篇文章的作者谈过了).

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).

这篇关于有人尝试过 Crystal 编程语言(机器代码编译的 Ruby)吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆