我应该学习 MacRuby 还是 RubyCocoa
我想学习使用 ruby 进行 mac 开发,但我不确定该选择哪一个。 RubyCocoa 已经存在了很长时间,但我认为从长远来看,MacRuby 会击败它。
有什么建议吗?
I am wanting to learn mac development with ruby but I'm not sure which one to go at. RubyCocoa has been around longer but I think MacRuby will beat it out in the long run..
Any suggestions??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
和 MacRuby 一起去吧。 这就是未来 :)
它更新、更快、集成度更高。 HotCocoa 也很棒。
MacRuby 是在 Apple Technologies 之上实现的 Ruby VM,而不是像 RubyCocoa 这样的桥。 例如,Ruby String 本质上是 NSString,而不是由运行时桥接。 这是一种更干净、更快、更可靠的方法。 它也是由 Apple 开发和赞助的,这意味着它可能在某个时候成为 OS X 的一部分。
另请参阅这篇文章:为什么 MacRuby 很重要
Go with MacRuby. It's the future :)
It's newer, way faster, and much better integrated. HotCocoa is awesome as well.
MacRuby is a Ruby VM implemented on top of Apple Technologies as opposed to a bridge like RubyCocoa. A Ruby String for example is an NSString by nature, instead of being bridged by the runtime. It's a much cleaner, faster and more solid approach. It's also developed and sponsored by Apple, which means it could become part of OS X at some point.
Also see this post: Why MacRuby Matters
自从 Chuck 回复你以来,情况发生了很大变化,MacRuby 现在使用 LLVM,允许 AOT 编译,并且非常稳定,比以前快得多。 ruby 方面仍然需要一些工作才能实现 100% 兼容,但在我撰写此回复时,0.5 仍处于测试阶段,您应该会看到 ruby 库很快就会兼容。
Since Chuck replied to you, things changed quite a lot, MacRuby now uses LLVM, allows for AOT compilation and is quite stable and much faster than it used to be. The ruby side of things still need some work for be 100% compatible but as I'm writing this response, 0.5 is still in beta and you should see ruby libraries being compatible very quickly.
RubyCocoa 更加成熟并且经过了更好的测试。 MacRuby 整体上更简单,设计也更好。 MacRuby 也像沙滩球上的草坪椅一样稳定。 严重地。 从长远来看,它绝对是您想要使用的一款,但目前还没有。 它们并没有那么不同,以至于你必须“学习”其中一种。 它们都是可以访问 Cocoa API 的 Ruby。 更重要的是了解 Cocoa API。
我建议使用 Objective-C 来学习 Cocoa。 一旦你很好地掌握了框架的中心概念(它们都是基于 Objective-C 的),那么如果你还想的话,你可以使用 Ruby。
2011 更新
对于 MacRuby,上述情况不再适用。 它非常稳定且快速,足以在纯 Ruby 中执行大多数类型的 Cocoa 应用程序。 MacRuby 团队还竭尽全力与几乎所有系统框架兼容,甚至包括 C 框架。 如果你喜欢 Ruby 并且想做 Mac 开发,这绝对是值得考虑的事情。 没有理由再选择 RubyCocoa 除非您需要支持旧版本的 OS X 或 PowerPC(MacRuby 严格来说是 Intel 10.5+)。 剩下的注意事项:
必须在应用程序中包含 MacRuby.framework 会对捆绑包大小产生较高的下限(“Hello World”IIRC 为几十 MB)
尽管它总体上很稳定,但它仍然是非常新的测试版软件,因此在库的较少使用的角落中存在一些问题(例如,指针有一些怪癖),并且一些设计决策不是最终的(例如,并发支持正在迅速发展)
文档仍在进行中,并且落后于快速的动人的语言。 您会发现很多有关 MacRuby 的文章都表明 HotCocoa 是制作应用程序的一种很酷的原生方式 — 这是一个很酷的实验,但它现在已成为废弃软件,存在一些严重缺陷,使其不适合大规模应用程序开发。 标准 Xcode 工具链是进行 MacRuby 开发的受支持方式。
我还仍然建议使用 Objective-C 来学习 Cocoa,因为这是该框架的母语,因此是阻力最小的路径。
RubyCocoa is more mature and better tested. MacRuby is simpler and better designed overall. MacRuby is also about as stable as a lawn chair sitting on a beachball. Seriously. It's definitely the one you want to use in the long run, but it isn't there yet. They're not so different that you'd have to "learn" one versus the other. They're both just Ruby with access to the Cocoa APIs. It's more about knowing the Cocoa APIs than anything else.
I would recommend learning Cocoa with Objective-C. Once you have a good grasp on the central concepts of the framework (which are all based on Objective-C), then you can use Ruby if you still want to.
Update 2011
The above is no longer true of MacRuby. It's very solid and fast enough to do most kinds of Cocoa applications in pure Ruby. The MacRuby team have also gone out of their way to be compatible with pretty much all of the system frameworks, even the C ones. If you like Ruby and want to do Mac development, it's definitely something to consider. There is no reason to choose RubyCocoa anymore unless you need to support ancient versions of OS X or PowerPC (MacRuby is strictly Intel 10.5+). The remaining caveats:
Having to include MacRuby.framework in your apps puts a high lower boundary on bundle size (a couple dozen MB for "Hello World" IIRC)
Although it's stable in general, it's still very new beta software, so there are a few wrinkles in the less-used corners of the libraries (e.g. Pointers have a few quirks), and some design decisions aren't final (e.g. concurrency support is evolving rapidly)
The documentation is still a work in progress, and lags behind the fast-moving language. A lot of articles you'll find about MacRuby suggest that HotCocoa is the cool, native way to make apps — it is a cool experiment, but it is now abandonware with some critical flaws that make it unsuitable for large-scale application development. The standard Xcode toolchain is the supported way to do MacRuby development.
I also still recommend learning Cocoa with Objective-C, just because that's the framework's native language and thus the path of least resistance.