Python、Lua和Ruby比較——腳本語言大P.K.

譯者按: Python、lua和ruby在C/C++是日漸式微的狀況下,在java/.net的圍殲中努力抗爭的三個當紅小生。在Tom Gutschmidt的著做《Game Programmng with Python, Lua and Ruby》一書中,介紹了三種語言在遊戲中的應用,其中尤其了不得的是在書中最後一章中比較了三種腳本,做者沒有說孰優孰劣,可是讀者你認爲呢?歡迎留言討論。
本文最初發表於戀花蝶的博客 http://blog.csdn.net/lanphaday,歡迎轉載,但敬請保持全文完整。
 
Python versus Lua Versus Ruby
Python、Lua和Ruby——腳本大P.K.
Tom Gutschmidt 著
 
So which of the three languages is the best to use on your project? That depends a great deal on what you want to accomplish. To wrap up the book, I've outlined some of the pros and cons of each language in this section.
這三種語言中的哪種更合適你的項目?很大程度取決於你想達到什麼樣的目標。做爲一書的結尾,在這一節裏,我會描述一下它們各自的優勢和不足。
Python Pros and Cons
Python的優勢和不足
The pros of Python are as follows:
Python的優勢以下:
·         Python has more extension modules than the other languages.
·         Python比其它語言有更多擴展模塊。
·         Many online Python tutorials exist. There are also plenty of English books and reference materials, many sample scripts exist online, and there is a wealth of introductory material. The Python.org Website is a good place to start looking for these because it has sections for beginners, tutorials, guides organized by topic, and lists of links and references.
·         在網上能夠找到不少Python教程。不只如此,還有大量的英文書籍和資料。Python.org有不少爲初學者準備的依主題組織的資料、教程和編程指南,此外還有不少連接和參考。
·         Most folks really enjoy the syntax of the Python language because it appears clean and is easy to read.
·         不少人都喜歡Python語言的語法,由於它清晰易讀。
·         Python has an edge where libraries are concerned. There are many libraries, and, for the most part, they are well documented.
·         Python在支持庫上大佔優點,由於它有不少庫,並且大部分都有完善的文檔支持。
·         Lots of tools that tie into Python are available, and they are often easier to find than the tools for Lua and Ruby.
·         不少工具能夠用於Python,但難以找到適用於Lua和Ruby的。
The cons of Python are as follows:
Python的不足:
·         Existing Python debuggers are considered quirky and slow. Debugging support on Macintosh and consoles is even weaker.
·         現有的Python調試器詭異並且效率低下。在Macintosh(蘋果計算機)和控制檯下進行調試是一個夢魘。
·         It can be difficult to bundle Python with other languages. There are lots of binary DLLs, and Python has (compared to the other languages) a large standard distribution.
·         Python難以與其它語言集成,它有太多的二進制DLL,並且Python帶了巨大的標準發佈包。
·         Lots of folks really dislike the white space sensitivity of Python syntax.
·         一樣的,也有不少人不喜歡Python對空白符敏感的語法。
·         Python can be quite slow at times, as everything is an object on the heap.
·         由於堆上的任何東西都是對象,因此Python有時候會慢得難以忍受。
Lua Pros and Cons
Lua的優勢和不足
The pros of Lua are as follows:
Lua的優勢:
·         Lua is probably the fastest of the three languages and usually uses the least amount of runtime memory.
·         Lua在這三種語言中是運行時速度最快並且佔內在最少的。
·         Lau has the smallest memory footprint for bundling.
·         集成Lua只會增長極少的內存佔用率。
·         The Lau C API is very well documented and has good examples for integrating with C.
·         Lua的C API有着完備着文檔和很好的例子,能夠容易地經過C集成在軟件裏。
The cons of Lua are as follows:
Lua的不足:
·         The documentation has improved but is still a bit sketchy overall. Of the three languages, Lua it is probably the least documented (the API being the exception), with the least amount of code comments. This makes for the largest ramp-up time to learn, and there isn't much in the way of introductory Lua material.
·         儘管Lua的文檔已經增進很多,但仍然有所不足。三種語言中,Lua多是文檔最少的(API方面是個例外),由於代碼中極少註釋,這也增長了學習的難度。另外,對Lua的本質也沒有什麼介紹。
·         There isn't a lot of built-in functionality for Lua. There is little support if you need to create a large, complex application.
·         Lua內建的功能不多,並無對建立大型的複雜應用程序提供足夠支持。
·         Lua could use a better garbage collectorthe current development is moving towards that now. Right now, Lua GC uses a very simple and traditional simple mark and sweep.
·         Lua應該使用更好的垃圾收集機制,Lua如今的GC仍然使用很是簡單並且傳統的「標記和清除」方式。
Pros and Cons of Ruby
Ruby的優勢和不足
The pros of Ruby are as follows:
Ruby的優勢:
·         Ruby possesses fairly good advanced debuggers.
·         Ruby有極好的高級調試器。
·         Ruby is object oriented from the ground up, and programmers who are OOP enthusiasts or who are used to the OOP paradigm will find the language extremely comfortable.
·         Ruby是最完全的面嚮對象語言,對於OOP狂熱者和慣於使用OOP範式的程序員,他們將會發現Ruby是最適合他們的語言。
·         Ruby has arguably the simplest syntax, with no real rules exceptions. Especially true for OOP enthusiasts.
·         Ruby的語法極爲簡單,沒有讓人出乎意料規則,特別適合OOP行家的習慣。
The cons of Ruby are as follows:
Ruby的不足:
·         Lack of English documentation.
·         英文文檔極度缺少。
·         Fewer existing works and samples for games than with the other languages.
·         與其它語言相比,在遊戲方面所做的工做和實例都少得多。
相關文章
相關標籤/搜索