logoalt Hacker News

Spinel: Ruby AOT Native Compiler

81 pointsby dluantoday at 8:28 AM19 commentsview on HN

Comments

whizztertoday at 9:21 AM

If it wasn't built by Matz I'd have severe doubts, but it's clearly defined and I presume he knows all limitations of the Ruby semantics well.

My thesis work (back when EcmaScript 5 was new) was an AOT JS compiler, it worked but there was limitations with regards to input data that made me abandon it after that since JS developers overall didn't seem to aware of how to restrict oneself properly (JSON.parse is inherently unknown, today with TypeScript it's probably more feasible).

The limitations are clear also, the general lambda calculus points to limits in the type-inference system (there's plenty of good papers from f.ex. Matt Might on the subject) as well as the Shed-skin Python people.

eval, send, method_missing, define_method , as a non-rubyist how common are these in real-world code? And how is untyped parsing done (ie JSON ingestion?).

show 1 reply
nu11ptrtoday at 10:26 AM

Wow, written in just over a month. Say what you will about AI, but it has enabled serious speedups in the hands of a talented coder.

show 1 reply
dluantoday at 9:53 AM

For some context, just presented by Matz at RubyKaigi 2026. It’s experimental but he built it with help from Claude in about a month. Successful live demo.

It’s named after his new cat, which is named after a cat in Card Captor Sakura, which is the partner to another character named Ruby.

nonatoday at 9:48 AM

This is really cool, I've been looking for an AOT compiler for ruby for a long time.

The lack of eval/meta-programming fallbacks is a shame though, but I guess they kept the focus on a small, performant subset.

It would be nice to have gems compiled with this AOT compiler that can interact well with MRI.

When it comes to packaging/bundling more standard ruby (including gems) we'll still need tebako, kompo, ocran – and then there's a bunch of older projects that did similar things too like ruby-packer, traveling ruby, jruby warbler etc.

It's nice to have another option, but still, I'm hoping for a more definitive solution with better developer UX.

denshtoday at 10:25 AM

As someone who spent a few years working on a compiler in this space — it’s tough, but are the results of instant startup and immediately decent performance without warm-up satisfying to use in practice. I really hope this takes off and yet another language can break free from dominant interpreter + jit compiler monoculture that we currently have for higher-level programming languages.

Maledictustoday at 9:39 AM

wow, I wanted to have this for a long time. I looked at Crystal, but it never sat right with me.

I think some of the limitations can still be implemented (definitely Threads and Mutex), and I'd prefer it to compile to LLVM-IR or something, not C, but overall I think it is great to see Matz playing around with AOT compiling.

xz18rtoday at 9:34 AM

Given it's built by Matz, how realistic is it that this becomes a core part of Ruby? And if so, how threatening is that for Crystal?

show 1 reply
zhismetoday at 11:00 AM

Even Matz now uses claude code...

show 1 reply
shevy-javatoday at 9:32 AM

I find the current documentation difficult to understand.

This is a problem I see with many ruby projects. How would I reword this?

Well, first thing, after stating what spinel is, I would show a simple example. Ideally a standalone .rb file or something like that, that can be downloaded (or whatever other format). Yes, the README shows this, but believe it or not, I have realised that I am usually below average when trying to understand something that is now. I even manage to make copy/paste mistakes. This is why I think one or two standalone as-is examples would be best.

And then I would explain use cases.

The current structure of the document is strange. Has that been written with AI? If AI replaces the human individual, why is it then expected that real people should read that? So many questions here ...

Also, I would really like for the ruby ecosystem to not be split up into different entities. I understand that mruby does not have the same goals as MRI ruby, but still, there is fragmentation. Now there is spinel - how does it relate to other parts of ruby? Why are truffleruby and jruby separate? (I know why, so I am not objecting to the rationale; I am pointing out that for a USER it would be better if things would be more unified here in general.)

Ruby really needs to focus on its inner core. The base should be solid. Even more so when it is harder to attract genuinely new developers.

claudiugtoday at 9:48 AM

is this done by matz and claude? :)