←新闻详情

DevClass更新于 10月21日 22:36

Ruby 之父 Matz 借助 Claude Code 开发原生编译器 Spinel

Ruby inventor Matz working on native compiler with AI help

AI 导读

Ruby 发明者松本行弘(Matz)正在开发原生编译器 Spinel,借助 Anthropic 的 Claude Code 完成,项目已在 GitHub 以 MIT 许可证开源。Spinel 将 Ruby 代码解析为 AST 后转换为 C 代码,再由 gcc 或 Clang 编译为独立原生可执行文件,测试中编译后代码比 MiniRuby 快约 11.6 倍。它目前仅支持 Ruby 子集,不支持 eval、线程、非 UTF-8 编码和运行时元编程,也无法运行 Ruby on Rails 等多数现有代码,仓库中多数代码带有 Claude Open 4.7(1M context)共同作者注释。

推荐理由

AI 评分 60

Ruby 之父用 Claude Code 数周内做出原生编译器,可对照 AI 辅助开发在成熟语言项目中的实际边界。

主题

标签

正文

当前显示原文,中文全文译文尚未就绪。

DevOps

Yukihiro Matsumoto - better known as Matz - is building Spinel, a native compiler for Ruby, with help from Anthropic's Claude Code.

Spinel, which is on GitHub under the MIT license, works by parsing Ruby code into AST (abstract syntax tree) files, then converting it to C code for compilation by a standard C compiler. In Matz’s tests, Spinel-compiled code runs approximately 11.6 times faster than MiniRuby - a stripped-down Ruby build - using the in-development Roby 4.1.0.

The output is C code, compilable to a native executable via gcc (GNU Compiler Collection) on Linux or Windows (with MinGW - Minimalist GNU for Windows), or via LLVM's Clang on Linux or macOS. BSD will "probably work", according to the readme, but is not tested.

Ruby is an interpreted language, meaning it depends on a runtime engine to parse and run the code. In order to improve performance, Ruby can use just-in-time (JIT) compilers including MJIT (method-based JIT), YJIT and ZJIT, with the latter two developed by Shopify, a prominent Ruby user. Spinel is different in that it generates standalone native code executables, which can be deployed without any additional runtime.

The downside of Spinel is that it supports only a subset of Ruby. Unsupported features include eval statements, which evaluate and execute Ruby code at runtime, threads, text encoding other than UTF-8, metaprogramming such as defining a method at runtime, and deeply nested lambda functions.

Ruby variables are not typed, though objects are strongly typed. Spinel performs type inference to enable C code generation, since C is a strongly typed language. The code makes use of an existing and mature Ruby parser called Prism. There are many optimizations, such as method inlining and dead code elimination, and the generated C compiles cleanly at the default warning level. Spinel includes a garbage collector, to reclaim memory automatically, and supports FFI (foreign function interface) for integrating with native code libraries such as libc or SQLite.

Spinel is experimental and will not work with most existing Ruby code, including the web application framework Ruby on Rails. But it is possible for Ruby developers to write code with Spinel in mind, such as for helper functions that can then be called from other Ruby code, as a means of optimization.

Matz presented Spinel at RubyKaigi 2026, a conference in Hakodate, Japan last month. According to attendees such as this one (original text in Japanese) Matz said the idea for Spinel was conceived three years ago, but has now been implemented in a few weeks using AI.

Most of the code in the Spinel repository is headed with a comment including "co-authored by: Claude Open 4.7 (1M context)."

Further, the project has already been rebuilt three times over, in a series of experiments.

Matz, perhaps, is an ideal user of AI-generated code. He understands the code, and can benefit from the increased speed of development without losing grip on what the code does, and is able to refine it with his existing skills as well as with further AI prompting, and the code is covered by hundreds of tests and benchmarks.

When you just need to build a tiny desktop app: TinyJS

October 13, 2026

Valen creator drives 'Golden Spike' to connect new languages with Rust

September 26, 2026

Microsoft agentically ports Copilot runtime to Rust for $120K

September 19, 2026

Apple iPhone Duo makes developers think in folds

September 16, 2026

JavaScript installer pnpm recast in Rust because ECMAScript can't keep up

September 5, 2026

Kubernetes cleans house, bins legacy kube-dns, IPVS, and cgroup v1

August 27, 2026

How Cursor beat Git's scalability shortcomings

August 24, 2026

Go updates may delight diehard gophers but displease AI overlords

August 21, 2026

SvelteKit 3 puts heat on Next.js with radical approach to RPCs

August 20, 2026

Almost nobody pays attention to web standards anymore

August 18, 2026

ChainDrop worm crawls into npm supply chain, evades standard defenses

August 16, 2026

Node.js creator liberates Durable Objects from Cloudflare

August 13, 2026

AI titans to tidy agent frontier with plugin prescription

August 8, 2026

Platform Engineering 2.0: your platform was built for a different era. AI just exposed it

August 6, 2026

Next.js 16.3 aims to reduce dreaded FATAL ERROR messages

August 5, 2026

Dev who gave HashiCorp its name returns with a faster terminal multiplexer

August 1, 2026

How AI drove Shopify back to clean code

Turns out, agents just want the same things as humans: easily-readable code, explicit contracts, and helpful feedback

July 26, 2026

Zig creator calls Bun's Claude Rust rewrite 'unreviewed slop'

July 15, 2026

HTTP gets a QUERY method so complex searches can stop pretending to be POST

July 14, 2026

Speedier type checks in TypeScript 7.0 as first stable Go release ships

July 10, 2026

GitHub cuts short offer to burn repos on CD after mockery ensues

A purported jab of Sony's physical media phase-out blows up on GitHub itself

July 7, 2026

.NET's long term support is not long term enough, dev complains

June 30, 2026

来源

DevClass