Mirah 相对于 JRuby、Groovy 和 Scala 提供了什么?

发布于 2024-10-03 17:20:52 字数 99 浏览 7 评论 0原文

Mirah 语言 相对于 JRuby、Groovy 和 Scala 提供什么?

What does Mirah language offer over JRuby,Groovy and Scala?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

余罪 2024-10-10 17:20:53

根据对 Mirah 创作者的采访 Mirah(爪哇语中的意思是“Ruby”)的目的是创建 Ruby 的高性能变体。足够的类似 Ruby 的语法使其使用起来很舒适,但仍然足够接近 Java 和 JVM 语义,因此它可以在没有 JVM 之上的大量运行时层开销的情况下运行。

选择报价:

Mirah 相对于类似语言的优势主要在于它的轻量级。在 Groovy、Scala、JRuby、Clojure 或 Jython 中,当您编写“Hello, world”的那一刻,您就将自己束缚在运行时库中。在 Mirah 中,“Hello, world”与 JRuby 中一样简洁,但还有一个额外的好处,即不会向您强加任何依赖项;源文件进去,类文件出来,就是这样。我相信 JVM 需要一种新的无依赖语言,Mirah 是我尝试提供的一种语言。

虽然 JRuby 的性能可与其他 Ruby 解释器相媲美或超过,但最快的 JRuby 代码仍然落后于纯 Java 性能一个数量级。虽然您可以期望 JRuby 的性能在 1.6 版本中得到提高,但 Mirah 是突破性能上限的一次尝试,并为寻求与 Java 代码同等执行速度的程序员提供了一个选择。

According to an interview with Mirah's creator the point of Mirah (which means "ruby" in Javanese) is to create a high-performance variant of Ruby. Enough Ruby-like syntax to make it comfortable to work with, but still close enough to Java and JVM semantics so that it can run without the overhead of a big runtime layer on top of the JVM.

Choice quote:

Much of the benefit of Mirah over similar languages comes down to being so lightweight. In Groovy, Scala, JRuby, Clojure, or Jython, the minute you write "Hello, world", you've shackled yourself to a runtime library. In Mirah, "Hello, world" is just as terse as in JRuby, but has the added benefit of not foisting any dependencies on you; source file goes in, class file comes out, and that's it. I believe the JVM needs a new dependency-free language, and Mirah is my attempt to deliver one.

While JRuby's performance rivals or exceeds other Ruby interpreters, the fastest JRuby code still lags pure Java performance by an order of magnitude. While you can expect the performance of JRuby to improve with the 1.6 release, Mirah is an attempt to break through the performance ceiling and provide an option for programmers looking for execution speeds on par with Java code.

飞烟轻若梦 2024-10-10 17:20:53

对比Groovy

  • 语法对于现有 Ruby/JRuby 程序员来说更熟悉
  • 静态类型

与静态 类型JRuby

  • 静态类型

与静态 类型Scala

  • 语法对现有 Ruby/JRuby 程序员来说更熟悉

主要优点是静态类型(JVM 性能更快,与现有 Java 库的互操作更容易)和熟悉的语法(如果您来自 Ruby)。

当依赖项是一个考虑因素时(例如,开发 Android 应用程序),那么您不应该让它指导您的语言选择。使用 Proguard 这样的工具将创造公平的竞争环境。

如果您来自 Ruby,那么 Mirah 是一个不错的选择。如果您来自 Erlang 或 Haskell,那么您会需要 Scala。如果您是一名 LISPer,那么您会想看看 Clojure。

如果您以前唯一的经验是 Java,那么您真丢脸! - 你可能应该选择 Scala - 作为 Java 的继承者,它正在迅速赢得声誉,目前工具支持更强大,并且您将加入一个由其他人组成的大型社区,他们也进行了相同的转变,因此有很多博客/教程已经可用。

和格罗维?如今,Groovy 几乎从来都不是正确的选择......

vs. Groovy

  • Syntax more familiar to existing Ruby/JRuby programmers
  • Statically typed

vs. JRuby

  • Statically typed

vs. Scala

  • Syntax more familiar to existing Ruby/JRuby programmers

The MAIN advantages are static typing (faster performance on the JVM and much easier interop with existing Java libraries) and a familiar syntax (if you come from Ruby).

When dependencies are a consideration (developing an android app, for example) then you shouldn't let this guide your language choice. Using a tool like Proguard will level the playing field.

If you're coming from Ruby, then Mirah is a good choice. If you're coming from Erlang or Haskell, then you'll want Scala. If you're a LISPer, then you'll want to take a look at Clojure.

If your only prior experience is Java then Shame on you! - and you should probably go for Scala - It's rapidly gaining a reputation as the heir apparent to Java, tool support is currently stronger and you'll be in a large community of others who made the same transition, so there are plenty of blogs/tutorials already available.

and Groovy? Groovy is almost never the right choice nowadays...

抚笙 2024-10-10 17:20:53

我每天在 Google AppEngine 上使用 Mirah。

以下是我使用 Mirah 的原因:

  • 的运行时库
  • 非常好的语法
  • 没有像 Java 一样快

在引擎盖下使用 Java 也非常有帮助:

  • 可靠的类型系统
  • 记录良好的
  • 常见问题的已知解决方案

我使用了一些 Groovy,大量的 JRuby,但没有使用 Scala。
如果您了解这些,请尝试 Mirah。
如果没有,我会选择 JRuby。

I use Mirah everyday on Google AppEngine.

Here are my reasons to use Mirah:

  • no runtime library
  • very nice syntax
  • as fast as Java

Having Java under the hood is very helpful too:

  • solid typesystem
  • well documented
  • known solutions for common problems

I did some Groovy, lot of JRuby and none of Scala.
If you know these, try Mirah.
If not, I'd go with JRuby.

还给你自由 2024-10-10 17:20:53

Mirah 只是 java 的另一种 ruby​​ish 语法。恕我直言,一点都不好。它对泛型一无所知,而且工具也很差。最好尝试 ceylon、xtend、scala、kotlin 等
Mirah 编译为 java 类(不再是源代码)。 Xtend 编译为 java 源代码,因此更容易了解它的底层功能。 Ceylon 和 scala 有自己的 stdlib(尽管如此,它们的 java 互操作都接近完美),不确定 kotlin。 Kotlin 是 JetBrains 的孩子,因此与 IDEA 息息相关。
JRuby我也不喜欢。 java interop 中存在太多错误。而且它还有太多重新发明的轮子。我的意思是编码(它不使用 java 字符串和正则表达式,而是在原始字节缓冲区之上使用自定义字符串)、IO、异常处理、线程等。
jruby 唯一的优点就是它是 ruby​​。许多 ruby​​ 代码将按原样运行。
Groovy OTOH 并没有重新发明轮子,它使用经过良好测试的 Java 库,只是添加了语法糖。 groovy-java 互操作也很棒。它可以泛型。线程、异常、字符串、集合——都只是 Java 类,就像它们在 java 中一样。

Mirah is just another rubyish syntax for java. IMHO not good at all. It knows nothing about generics, and also has poor tooling. Better try ceylon, xtend, scala, kotlin etc.
Mirah compiles to java classes (not sources anymore). Xtend compiles to java sources and so simpler to found out what it does under the hood. Ceylon and scala have their own stdlibs (nevertheless java interop is near to perfect in them both), not sure about kotlin. Kotlin is JetBrains' child and thus tied to IDEA.
JRuby I don't like too. It has too many bugs in java interop. And it also have too many reinvented wheels. I mean encodings (it does not use java strings and regexes but custom strings on top of raw byte buffers), IOs, exception handling, threads etc.
The only advantage of jruby is that it is ruby. Many ruby code will just work as it is.
Groovy OTOH does not reinvent the wheel, it uses well tested java libraries and just adds syntax sugar too them. Also groovy-java interop is great. It can generics. Threads, exceptions, strings, collections - are just java classes as they are in java.

意犹 2024-10-10 17:20:52

与带有自己的库的全功能语言不同,Mirrah 更像是 Java 库的不同“前端”。

Mirrah 代码不依赖于它自己的环境(编译时的 Mirrah 编译器除外)。

这就是主要的好处:Java 的语法不同。

Unlike full-featured languages, which come with their own libraries, Mirrah is more like a different "frontend" to the Java libraries.

Mirrah code does not depend on it's own environment (except the Mirrah compiler at compile time).

That's the main benefit: A different syntax for Java.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文