Live data from Hacker News

Spinel: Ruby AOT Native Compiler

github.com

71–80 of 93 posts

Re: Spinel: Ruby AOT Native Compiler

#71

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…

if spinel gets to where it can compile 100% of mruby there could be some nice synergies there.

Re: Spinel: Ruby AOT Native Compiler

#72

Curious why "no threads" when the ruby scheduler and underlying pthread implementation should work fine in C land. I guess to be "zero dependency"? Seems an odd trade-off to me, unless optional "extensions" are planned / omitted for later implementation etc.

I don’t see anywhere that it’s something they specifically decided not to support. Probably they just haven’t gotten around to it yet? Multithreading is notoriously difficult to get right.

It says it isn't supported right in the readme. Just isn't clear on the "why" yet. Not getting to it yet is my hope. I maintain 14+ highly threaded ruby services atm, for context.

Re: Spinel: Ruby AOT Native Compiler

#73
post #8

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 – an…

Yeah I had to fork warbler recently since it hasn't been updated in forever

Re: Spinel: Ruby AOT Native Compiler

#74
post #48
post #25

Limitations - No eval: eval, instance_eval, class_eval - No metaprogramming: send, method_missing, define_method (dynamic) - No threads: Thread, Mutex (Fiber is supported) - No encoding: assumes UTF-8/ASCII - No general lambda calculus: deeply nested -> x { } with [] calls Assuming UTF-8/ASCII isn’t, IMO, a huge limitation, but some of the others likely are, for quite a few programs. Removing them also will require s…

This removes a large portion of the magic of Ruby.

I do use class_eval quite a bit but I could pivot to precomputed script generators for those use cases going forward

Re: Spinel: Ruby AOT Native Compiler

#75
post #43

I will eat the downvotes to say what I actually think. Unless this gets back eval, metaprogramming and threads this isn't all that interesting as an actual language. There are plenty of compiled languages out there. Metaprogramming is what makes Ruby interesting and expressive. I know that this is just an experiment, but I've seen plenty of cases where stuff exactly like this gets forced into use in production becaus…

Spinel would be more interesting if this compiled subset could run side by side with interpreted Ruby, like Pallene does for (slightly modified) Lua.

Right now the cost of c interop in ruby is too high. It's actually more perfomant in the general case to rewrite any c lib wrappers in pure ruby these days and let jit do the work

Re: Spinel: Ruby AOT Native Compiler

#76

While obviously super-impressive, it is clearly not maintanable without AI agent. It has spinel_codegen.rb is 21k lines of code with up to 15 levels of nesting in some methods. Compilers code was never pretty, but even by those standard, I feel like it is a very-very hard to maintain code by humans.

Obviously it doesn't matter much now if it's maintabable by hand or not. If code is passing tests and benchmarks, I am happy.

But I am not sure that huge files are easy for the AI to work with. I try to restrict the files to 300 lines. My thinking is that if it's easy for a human to understand the code, it will be easy for coding agents, too.

Re: Spinel: Ruby AOT Native Compiler

#77
post #27

Earlier quoted context omitted.

> It’s experimental but he built it with help from Claude in about a month. We talk a lot about AI building programs from soup to nuts. But I think people overlook the more likely scenario. AI will turn 10x programmers into 100x programmers. Or in Matz’s case maybe 100x programmers into 500x programmers.

AI is the function f(x) = x • |x|. It turns 10x into 100x, 1x into 1x, and -10x into -100x.

Something there, but this sounds too optimistic for x ∈ [-1, 0] and too pessimistic for x ∈ [0, 1].

Re: Spinel: Ruby AOT Native Compiler

#78

Earlier quoted context omitted.

AI is the function f(x) = x • |x|. It turns 10x into 100x, 1x into 1x, and -10x into -100x.

Something there, but this sounds too optimistic for x ∈ [-1, 0] and too pessimistic for x ∈ [0, 1].

I should specify the domain to be ℤ

Re: Spinel: Ruby AOT Native Compiler

#79
post #10

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.

That cat story seems more than a little suspicious given the Ruby Central drama / its relation to the founders of Spinel.coop. This project feels likely vindictively named.

Re: Spinel: Ruby AOT Native Compiler

#80
post #2

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 inheren…

Given how common it is rails and how much it uses those, everywhere!
Post reply on HN