Mirah 相对于 JRuby、Groovy 和 Scala 提供了什么?
Mirah 语言 相对于 JRuby、Groovy 和 Scala 提供什么?
What does Mirah language offer over JRuby,Groovy and Scala?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
根据对 Mirah 创作者的采访 Mirah(爪哇语中的意思是“Ruby”)的目的是创建 Ruby 的高性能变体。足够的类似 Ruby 的语法使其使用起来很舒适,但仍然足够接近 Java 和 JVM 语义,因此它可以在没有 JVM 之上的大量运行时层开销的情况下运行。
选择报价:
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:
对比Groovy
与静态 类型JRuby
与静态 类型Scala
主要优点是静态类型(JVM 性能更快,与现有 Java 库的互操作更容易)和熟悉的语法(如果您来自 Ruby)。
当依赖项是一个考虑因素时(例如,开发 Android 应用程序),那么您不应该让它指导您的语言选择。使用 Proguard 这样的工具将创造公平的竞争环境。
如果您来自 Ruby,那么 Mirah 是一个不错的选择。如果您来自 Erlang 或 Haskell,那么您会需要 Scala。如果您是一名 LISPer,那么您会想看看 Clojure。
如果您以前唯一的经验是 Java,那么您真丢脸! - 你可能应该选择 Scala - 作为 Java 的继承者,它正在迅速赢得声誉,目前工具支持更强大,并且您将加入一个由其他人组成的大型社区,他们也进行了相同的转变,因此有很多博客/教程已经可用。
和格罗维?如今,Groovy 几乎从来都不是正确的选择......
vs. Groovy
vs. JRuby
vs. Scala
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...
我每天在 Google AppEngine 上使用 Mirah。
以下是我使用 Mirah 的原因:
在引擎盖下使用 Java 也非常有帮助:
我使用了一些 Groovy,大量的 JRuby,但没有使用 Scala。
如果您了解这些,请尝试 Mirah。
如果没有,我会选择 JRuby。
I use Mirah everyday on Google AppEngine.
Here are my reasons to use Mirah:
Having Java under the hood is very helpful too:
I did some Groovy, lot of JRuby and none of Scala.
If you know these, try Mirah.
If not, I'd go with JRuby.
Mirah 只是 java 的另一种 rubyish 语法。恕我直言,一点都不好。它对泛型一无所知,而且工具也很差。最好尝试 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.
与带有自己的库的全功能语言不同,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.