Anybody tried the Crystal Programming Language (ma

2019-03-09 08:10发布

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:

The Crystal programming language at GitHub

Statically compiled 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.

Has anybody tried the Crystal language? (I didn't yet, because of compilation problems with 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?

2条回答
放荡不羁爱自由
2楼-- · 2019-03-09 08:32

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

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

查看更多
beautiful°
3楼-- · 2019-03-09 08:44

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.

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.

查看更多
登录 后发表回答