Ruby 4.0.0 预览版 2 发布
Ruby 4.0.0 Preview2 Released

原始链接: https://www.ruby-lang.org/en/news/2025/11/17/ruby-4-0-0-preview2-released/

## Ruby 4.0.0-preview2 发布 Ruby 4.0.0-preview2现已发布,包含Unicode 17.0.0和Emoji版本17.0的支持等更新。 关键语言变化包括防止`nil`调用类似`to_a`的方法,使其行为与`to_hash`一致。 核心类更新影响`Binding`,限制了数字参数访问,以及`IO`,现在接受`Float::INFINITY`作为超时值。 几个标准库已更新(ostruct, pstore, benchmark等)。 此预览版还引入了实验性的JIT编译器:ZJIT(基于方法,目前未针对性能优化)和YJIT的更新,以及用于统计跟踪的配置更改。 RJIT已被移除,其实现已迁移到单独的仓库。 该版本包含3607个文件更改,并提供各种格式的下载 ([tar.gz](https://cache.ruby-lang.org/pub/ruby/4.0/ruby-4.0.0-preview2.tar.gz), [tar.xz](https://cache.ruby-lang.org/pub/ruby/4.0/ruby-4.0.0-preview2.tar.xz), [zip](https://cache.ruby-lang.org/pub/ruby/4.0/ruby-4.0.0-preview2.zip))。

相关文章

原文

We are pleased to announce the release of Ruby 4.0.0-preview2. Ruby 4.0 updates its Unicode version to 17,0.0, and so on.

Language changes

  • *nil no longer calls nil.to_a, similar to how **nil does not call nil.to_hash. [[Feature #21047]]

Core classes updates

Note: We’re only listing notable updates of Core class.

  • Binding

    • Binding#local_variables does no longer include numbered parameters. Also, Binding#local_variable_get and Binding#local_variable_set reject to handle numbered parameters. [[Bug #21049]]
  • IO

    • IO.select accepts +Float::INFINITY+ as a timeout argument. [[Feature #20610]]
  • String

    • Update Unicode to Version 17.0.0 and Emoji Version 17.0. [[Feature #19908]][[Feature #20724]][[Feature #21275]] (also applies to Regexp)

Standard Library updates

Note: We’re only listing notable updates of Standard librarires.

  • ostruct 0.6.1
  • pstore 0.2.0
  • benchmark 0.4.0
  • logger 1.7.0
  • rdoc 6.13.1
  • win32ole 1.9.2
  • irb 1.15.2
  • reline 0.6.1
  • readline 0.0.4
  • fiddle 1.1.6

Compatibility issues

Note: Excluding feature bug fixes.

Standard library compatibility issues

C API updates

JIT

  • YJIT
    • YJIT stats
      • ratio_in_yjit no longer works in the default build. Use --enable-yjit=stats on configure to enable it on --yjit-stats.
      • Add invalidate_everything to default stats, which is incremented when every code is invalidated by TracePoint.
    • Add mem_size: and call_threshold: options to RubyVM::YJIT.enable.
  • ZJIT
    • Add an experimental method-based JIT compiler. Use --enable-zjit on configure to enable the --zjit support.
    • As of Ruby 4.0.0-preview2, ZJIT is not yet ready for speeding up most benchmarks. Please refrain from evaluating ZJIT just yet. Stay tuned for the Ruby 4.0 release.
  • RJIT
    • --rjit is removed. We will move the implementation of the third-party JIT API to the ruby/rjit repository.

Miscellaneous changes

See NEWS or commit logs for more details.

With those changes, 3607 files changed, 197451 insertions(+), 285607 deletions(-) since Ruby 3.4.0!

Download

  • https://cache.ruby-lang.org/pub/ruby/4.0/ruby-4.0.0-preview2.tar.gz

    SIZE: 23444451
    SHA1: 132e450bbee3f61ed0b463ed1e2bd3a3a324339c
    SHA256: 0a3330dae710302e11f7f0323e83219ab3c6517984691a312c662f329c5120e1
    SHA512: b5e681cc84be59148485b9a2212dcf54d61cfee27431ceddb49bedc8baa913ec8b36da43242cb4f1791b25e4bfc1dcf72b5527288a0656f2933da898d0e0b40f
    
  • https://cache.ruby-lang.org/pub/ruby/4.0/ruby-4.0.0-preview2.tar.xz

    SIZE: 17554228
    SHA1: f8e8b98ea85ac82610ab601a21dc9a90c5c56a97
    SHA256: 0b92b15466d77a9d7e59e4a75f050d42cd50fe96c951d2b3b9f8029394cd9a43
    SHA512: 7afaa8d8e832ef0ded28f1caf874da69f16105e1b3aad5947c6911364159b4c6ebd3d7ea5d7d86708e9f2f06a047921b8302ca6e75ec429a3da846845f896976
    
  • https://cache.ruby-lang.org/pub/ruby/4.0/ruby-4.0.0-preview2.zip

    SIZE: 28933540
    SHA1: 48a235cfbfd4252dce81da870c792e32309e62b9
    SHA256: f5c68ee44dfcb76b61c07c437fa945814dfc516570b1c921506ac886960160ca
    SHA512: 508c685e46a641c74e2968daf650559503ce2bcaac3403654713adb2345c3ede2bace929294a1367afecac5edd6b2c42fa833f5313456f78c79151d310c860cf
    

What is Ruby

Ruby was first developed by Matz (Yukihiro Matsumoto) in 1993, and is now developed as Open Source. It runs on multiple platforms and is used all over the world especially for web development.

联系我们 contact @ memedata.com