JRuby 1.6.7 發布
JRuby 1.6.7 更新版本發布了,該版修復了Ruby 1.9 的一些兼容性問題,在性能方面也有不少改善,值得關注的變化有:
- Fix circular require issue in Rubygems introduced by our Maven gem support
- Fix regression in popen* where streams get prematurely closed
- Many 1.9-mode encoding bugs fixed in String, Regexp, StringIO, and YAML
- Win32OLE now works in 1.9-mode
- ffi on Win x64 now knows about basic types :size_t
- Use jzlib to fix a set of issues with out zlib library
- Reduced internal locking based on user reports
- C extensions work on OS X again
- Gems with gemspecs which contain UTF-8 multi-byte chars install in 1.9 mode
完整的列表請看:full list of resolved issues
JRuby是面向Ruby、基于Java虛擬機(JVM)的一種解釋程序,它結合了Ruby語言的簡易性和功能強大的JVM的執行機制,包括與Java庫 全面集成。Rails徹底加快及簡化了Web應用的開發,不過它讓人覺得不夠成熟,特別是在高端企業級功能方面。另一方面,Java平臺及其虛擬機、庫和 應用服務器的速度、穩定性和功能方面卻一直在提升,現在已被公認為是開發高端服務器應用的領先平臺。不過如果Java平臺不與Ruby等新興語言聯系在一 起,就有可能落后于流行趨勢。
示例代碼:
- require "java"
- include_class "java.util.TreeSet"
- include_class "com.example.CallMe"
- include_class "com.example.ISpeaker"
- puts "Hello from ruby"
- set = TreeSet.new
- set.add "foo"
- set.add "Bar"
- set.add "baz"
- set.each { |v| puts "value: #{v}" }
- cm = CallMe.new
- cm.hello
- $globalCM.hello
- class CallJava
- include ISpeaker
- def initialize
- super
- @count = 0
- end
- def say(msg)
- puts "Ruby saying #{msg}"
- end
- def addOne(from)
- # m.synchronize {
- @count += 1
- puts "Now got #@count from #{from}"
- # }
- end
- end
下載地址:http://jruby.org/download
【編輯推薦】