r/ruby • u/Erem_in • Oct 19 '26
Question Static Typing solved?
I have been using RBS for years now and even running my own newsletter about static typing https://newsletters.eremin.eu/ . Now, that our code is write with AI and in most cases - purely with AI, the strongest point against using static typing (like “it breaks beautiful ruby syntax and not readable”) is vanished now.
AI requires strict tooling to control its output. The role of ci pipeline with all possible tests, linters, checkers is now extremely important and static typing helps a lot with it.
For humans it is transparent, especially the pure RBS approach, but for LLMs it gives a safety net and a better layer to stick to the code and hollucinate less.
21
u/sshaw_ Oct 19 '26
Static typing has been "solved" for decades. You just need... a statically typed language, not Ruby!
14
u/yxhuvud Oct 19 '26
Llms work with not explicitly typed ruby just fine. Stop the fud, please.
11
u/poop-machine Oct 19 '26
The state of Ruby static typing is just sad. All these half-baked third-party tools, a myriad of ugly syntaxes, and no clear guidance from the maintainers. You'd think in this LLM era we'd already have a nice TypeScript-like solution.
4
u/not_sure_if_crazy_or Oct 19 '26
I feel like this is where the larger convo is going via Matz and spinel, no?
5
u/TheAtlasMonkey Oct 19 '26
Typing is a sign of bad architecture, bad documentation, or/and lack of ownership.
Complexity merchants came and promised the world that if we type, we will go faster.
But if types were the solution, then ecosystem like C, Go, RUST, JAVA, Crystal.. will have went at light speed. They didn't.
Another thing i noticed, is that every type people hate each others. I know that because i maintain some gems and those people email or dm me to propose typing (since it going to touch all codebase) and maybe add a Dependency.
When i tell them : USE RBS or join the effort that was published last month, they show the true face and start telling how the other implementation is ugly and their uglier implementation is better.
I worked with ex-shopify devs (pre-AI), they came with this mentality to type everything. They will use types for everything and slowdown everybody. Early this year, i was invited to some of their repos.. NONE had typing for their personal project. NONE.
So typing in Ruby is mostly a job security trick.
Now that LLM can generate tests without using typing, this whole circus is collapsing.
2
u/Codalio-SoftwareFact Oct 22 '26
Mostly agree, a type error is a way faster feedback loop for an agent than running the whole suite and guessing what broke.
One thing I’d watch though: agents will “fix” type errors the same way they fix failing tests, by loosening them. Widen a signature to
untyped, add a union that accepts anything, and suddenly it’s green again. So the types are only a safety net if someone’s reviewing changes to the signatures as carefully as the code.2
u/janko-m Oct 19 '26
Can you tell AI today to create RBS files for your whole app and keep maintaining it, provided you have Steep/Sorbet fail CI when new code isn’t typed?
In that case, it would mean the cost of maintaining type signatures is effectively gone, and I would see no reason to skip static typing.
Similarly, I recently added a Vitest suite for my JS to my Rails app. I did it because maintaining it is essentially free now; I don’t need to understand how to write these tests, and they specify edge cases and catch regressions.
2
u/harsh183 Oct 19 '26
I just subscribed!
I'm glad to see someone following typed ruby closely and I really wish this had come sooner with wide adoption like how it came through with Python and TypeScript.
A general question, do you think the future is with language native RBS or Sortbet? I looked into this earlier this year when exploring what types to write for my project and it seemed like Sorbet at least had extensive libraries mapped out through the efforts of Stripe and Shopify ensuring their reliability, while RBS had pretty little third party usage beyond the ruby side, so I went with Sorbet for a library I was maintaining.
1
u/kinvoki Oct 24 '26
I’m not an enemy of static typing in general, but when it comes to Ruby, I much prefer dry-types over RBS.
RBS is great for catching typos and getting better IDE autocomplete, but it doesn't protect your application boundaries. If a third-party API changes its payload or a webhook sends bad data, RBS won't stop it at runtime because it just sits in separate sidecar files. Also if I wanted to keep a set of files that described my actual code , I would just use typescript 😹
That’s why the dry-rb ecosystem shines. When you combine dry-types with dry-schema and dry-validation, you get real runtime defense., and for both humans and AI agents - clear definition of what your code expects and outputs . It handles the messy reality of web apps by coercing data (like turning a string "42" into an integer), validating nested payloads, and returning clear error messages right when bad data hits your system.
RBS makes sense for massive codebases doing deep internal refactors and human massive IDEs ( which I never found that useful even before AI ) . But for everyday practical reliability and parsing external data, keeping your type logic right in the code is just way more efficient, IMHO
0
u/fragileblink Oct 23 '26
Static typing is still not the best approach. Flexible code with duck typing is even more powerful now.
-4
u/MUSTDOS Oct 19 '26
Or you could use rubocop since a true statically ruby (crystal) is still held back LLVM.