2025-12-25
15 篇热帖
Ruby 4.0.0
Ruby 4.0.0 发布公告
发布者: naruse (2025年12月25日)
Ruby 4.0.0 现已发布,引入了“Ruby Box”和“ZJIT”等新特性,并进行了众多改进。
主要特性:
- Ruby Box: 一个实验性功能,用于隔离定义。通过设置环境变量
RUBY_BOX=1启用。 允许隔离猴子补丁、全局/类变量修改、类/模块定义以及加载的原生/Ruby 库,适用于测试用例隔离、并行 Web 应用部署、依赖更新评估等场景。 详情请参考:Ruby::Box。 - ZJIT: 全新的即时 (JIT) 编译器,是 YJIT 的下一代产品。需要 Rust 1.85.0 或更高版本构建,通过
--zjit启用。旨在提高性能并鼓励外部贡献。目前速度略慢于解释器和 YJIT,建议实验性使用。 - Ractor 改进: Ruby 并行执行机制 Ractor 进行了多项改进。引入了
Ractor::Port类,解决了消息发送和接收问题。Ractor.shareable_proc使共享Proc对象更方便。 内部数据结构优化减少了全局锁的竞争,提升了并行性能。Ractor 的目标是明年移除“实验性”状态。
语言变更:
*nil和**nil不再分别调用nil.to_a和nil.to_hash。- 逻辑二元运算符 (
||,&&,and和or) 可以在行首延续上一行,类似于点运算符。
核心类更新:
- Array: 增加了
Array#rfind和Array#find,提供更高效的查找方法。 - Binding:
Binding#local_variables不再包含编号参数。新增了Binding#implicit_parameters用于访问编号参数和 "it" 参数。 - Enumerator:
Enumerator.produce增加了size关键字参数,用于指定生成器的尺寸。 - ErrorHighlight:
ArgumentError异常显示调用方法和定义方法的代码片段。 - Fiber: 引入支持
Fiber#raise(cause:)参数。 - Fiber::Scheduler: 引入
Fiber::Scheduler#fiber_interrupt、Fiber::Scheduler#yield和 重新引入Fiber::Scheduler#io_close钩子。 - File:
File::Stat#birthtime在 Linux 上通过statx系统调用可用。 - IO:
IO.select接受Float::INFINITY作为超时参数。 - Kernel:
Kernel#inspect检查#instance_variables_to_inspect方法,允许控制在#inspect字符串中显示哪些实例变量。 - Math: 增加了
Math.log1p和Math.expm1。 - Pathname: 从默认 gem 升级为核心类。
- Proc:
Proc#parameters显示匿名可选参数为[:opt]。 - Ractor: 引入
Ractor::Port类,提供新的同步机制。新增了Ractor#join和Ractor#value用于等待 Ractor 终止。 - Range:
Range#to_set增加了大小检查,防止无限范围问题。 - Ruby: 定义了新的顶级模块
Ruby,包含 Ruby 相关常量。 - Ruby::Box: 提供定义隔离功能。
- Set: 升级为核心类。
- Socket:
Socket.tcp和TCPSocket.new接受open_timeout关键字参数。 - String: 更新 Unicode 到版本 17.0.0。
- Thread: 引入支持
Thread#raise(cause:)参数。
Stdlib 更新:
部分默认 gem 已升级或添加。
兼容性问题:
- Ractor 中
Ractor.yield、Ractor#take、Ractor#close_incoming和Ractor#close_outgoing被移除。 ObjectSpace._id2ref已弃用。
Nvidia buying AI chip startup Groq for about $20B in cash
Nvidia is making its largest purchase ever, acquiring assets from nine-year-old chip startup Groq for about $20 billion.
Show HN: Minimalist editor that lives in browser, stores everything in the URL
A notes webapp. Contribute to antonmedv/textarea development by creating an account on GitHub.
We invited a man into our home at Christmas and he stayed with us for 45 years
An arrangement Rob and Dianne Parsons thought would last a few days ended up changing their lives.
Show HN: Vibium – Browser automation for AI and humans, by Selenium's creator
Browser automation for AI agents and humans. Contribute to VibiumDev/vibium development by creating an account on GitHub.
Fabrice Bellard: Biography (2009) [pdf]
Fabrice Bellard: A Profile of an Influential Programmer (Fabrice Bellard, Andy Gocke, and Nick Pizzolato, 2009)
This article profiles Fabrice Bellard, a highly influential, yet relatively low-profile, computer scientist. Born in Grenoble, France, in 1972, Bellard demonstrated a passion for electronics and programming from a young age, starting with a TI-59 scientific calculator and later a TI-99/4A home computer.
Early Programming and Key Contributions:
- LZEXE: At age fifteen, Bellard created LZEXE, a pioneering executable file compression method for personal computers, inspired by LZSS. This showcased his early proficiency in low-level coding.
- Education at École Polytechnique: He attended the prestigious École Polytechnique, a French military academy specializing in engineering, which he found liberating due to its focus on breadth and extensive resources.
- Pollard’s FFT Implementation: In 1995, he implemented Pollard’s FFT fast multiplication method in C, enabling the calculation of millions of digits of π.
- Binary Digit Calculation of π: In 1997, he significantly improved the algorithm for calculating binary digits of π, achieving a 43% speed increase.
- TinyGL: In 2002, Bellard developed TinyGL, an exceptionally small and fast implementation of a subset of OpenGL.
- FFmpeg: Starting in 2000, he created FFmpeg, a versatile multimedia framework for recording, streaming, and converting various audio and video formats. This project, built on libavcodec and libavformat, has become a cornerstone of digital media processing.
- TinyCC: He won the International Obfuscated C Code Contest twice, leading to the creation of TinyCC, a remarkably small ANSI C99 compiler.
- QEMU: In 2005, he released QEMU, a processor emulator that uses dynamic translation to achieve near-native performance. This has become vital in virtualization technologies.
Bellard's Philosophy and Advice:
Bellard believes computer science should encompass both practical application and theoretical understanding. He emphasizes the importance of a strong foundation in computer hardware and low-level programming. He prioritizes open-source development, releasing his projects freely to benefit the wider community, driven by his passion for interesting and useful projects rather than financial gain. He encourages future computer scientists to study the fundamentals and gain a deep understanding of how computers work.
Key Themes:
The article highlights Bellard’s exceptional programming skills, his ability to innovate across diverse areas of computer science, and his commitment to open-source principles. His work demonstrates a deep understanding of both hardware and software, combined with an aptitude for mathematical innovation.
Who Watches the Waymos? I do [video]
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.
How I Left YouTube
What was the road like when I left?
Asterisk AI Voice Agent
An open-source AI Voice Agent that integrates with Asterisk/FreePBX using Audiosocket/RTP technology - hkjarral/Asterisk-AI-Voice-Agent
Spaced repetition for efficient learning (2019)
Efficient memorization using the spacing effect: literature review of widespread applicability, tips on use & what it’s good for.
Microsoft please get your tab to autocomplete shit together
What do you think is gonna happen after I press tab when looking at this screenshot?