Ruby 特性及其在编写脚本时的优势
我发现 Ruby 在 Web 编程方面取得了巨大成功。但是,对于桌面应用程序和脚本,我认为它没有被大量使用。事实上,在大多数 Linux 发行版中,它并不是默认安装的。大多数应用程序都是用 Python 编写的,有些则用 Perl 编写。在桌面应用程序和脚本方面,Ruby 比 Python 有哪些优势?如果我正在编写一个 Linux 应用程序(例如音乐播放器),那么 Ruby 块和元编程技术有何帮助?
编辑: 我看到有些人选择结束这个问题,因为它可能会升级为语言战争。不用担心,我是一名白天的 Python 程序员。我试图调和这些看似不相容的观察结果。事实上,大多数 Linux 发行版都没有安装 ruby。大多数 Linux 应用程序都是用 Python 编写的,这也是事实。而且Ruby比Python拥有更先进的元编程特性也是事实,这可以让开发变得更容易。我想知道为什么 Ruby 在 Linux 应用程序开发中没有得到那么多的使用,而 Linux 应用程序开发一直是脚本语言的游乐场。
I see that Ruby is a big success when it comes to web programming. However, for desktop applictions and scripts, I do not see it being heavily used. In fact, in most of the Linux distros, it does not come installed by default. Most applications are coded in Python and some are in Perl. What advantages can Ruby offer over Python when it comes to desktop applications and scrips? If i am writing one Linux application, say a music player, how Ruby blocks and metaprogramming techniques can help?
Edit:
I see that some have opted for close this question because it can escalate into a Language war, perhaps. Fear not, I am a day-time Python programmer. I am trying to reconcile these seemingly incompatible observations. It is fact that most Linux distros do not come with a ruby installed. It is also a fact that most Linux apps are coded in Python. And it is also a fact that Ruby has more advanced meta-programming features than Python, which can make development easier. I am wondering why Ruby is not used as much in Linux application development, which has been a playground for scripting languages.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Python 在 Linux 方面变得流行,因为许多发行版都使用它构建了各种前端工具,因此保证了它的可用性。
Ruby 确实具有您可能正在寻找的 Qt 绑定,并且可以为您需要与之交互的任何 C 或 C++ 库编写包装器。
最终,一切都归结于找到一个合适的例子来学习。您可能会发现有更多的 Python 示例可供参考,这可能会影响您的决定。
两种语言总体上能力相同,并且默认发行版在性能方面相似。如果您不介意坚持使用 Python 2.7,Python 的新 PyPy 编译器会更快,而且还有 Rubinius 这是一项旨在提高 Ruby 性能的努力。
Python has become popular on the Linux side because many distributions have built their various front-end tools using it so it's guaranteed to be available.
Ruby does have Qt bindings that might be what you're looking for and it's possible to write wrappers for any C or C++ library you need to interface with.
In the end it all comes down to finding a suitable example to learn from. You may find that there are far more Python examples to refer to and this may affect your decision.
Both languages are equally capable on the whole and the default distributions are similar in terms of performance. Python's new PyPy compiler is faster if you don't mind sticking to Python 2.7, and there's also Rubinius which is an effort to boost Ruby's performance.