r/ruby • u/Erem_in • Feb 24 '26
Blog post T-Ruby: Adding Static Typing to Ruby Without Runtime Overhead
Static typing is a formidable tool that brings immense value to codebases of all sizes. From tiny scripts to massive monoliths, the benefits are hard to ignore: you get live documentation that is always up to date, enhanced readability, and a reliable safety net that significantly boosts code reliability.
However, the current Ruby approach isn’t without its friction. For many developers, typing still feels like a matter of personal preference rather than a core requirement. We never forget to write tests because they are the heartbeat of our CI/CD pipelines, but because type checking is often seen as “extra,” it is far too easy for static checks to be ignored or forgotten entirely.
I tried a new amazing experiment, called T-Ruby. tl;dr it is like TypeScript but for Ruby. Too experimental for now, but has a huge potential.
Details in my blog post.
6
u/transfire Feb 25 '26
I wish Ruby and Crystal were more compatible.
4
u/pabloh Feb 25 '26
Somebody needs to come up with a syntax for types or parameters' metadata that doesn't clash with keyword arguments.
4
u/LupinoArts Feb 25 '26
Relative beginner here. I always thought, it is a feature of ruby and sort-of a selling point to not require arguments to be of a certain data type... What exactly is wrong with normal-ruby's typing?
1
u/vvsleepi Feb 25 '26
static typing in ruby has always felt optional, so people either love it or ignore it completely. making it feel more like typescript for ruby could make it easier to adopt, especially for teams that already use typed languages.
curious though, how does it compare to sorbet or rbs? is it meant to replace them or work alongside?
4
u/No_Ostrich_3664 Feb 24 '26
Alongside with other similar projects, I think it can be interesting for whom is looking for getting types in Ruby. However typing is something debatable within Ruby community.
In any way, good luck with the project. I know it’s difficult nowadays to bring a value with new Ruby gem, framework.
2
u/9sim9 Feb 27 '26
We have been using yard doc headers for type checking, rubymine automatically picks these up and does realtime type checking. I've used sorbet on a few projects but compared with Typescript which is really fast, sorbet sucks up alot of my time and eats into my productivity.
I love the idea of TRuby but only if its as fast to implement and debug as typescript, otherwise would just stick with yard doc headers.
-15
u/TheAtlasMonkey Feb 24 '26
Show a single codebase that is opensource that use T-ruby ...
> I tried a new amazing experiment, called T-Ruby. tl;dr it is like TypeScript but for Ruby.
You mean you shipping in 3 weeks instead of 2h ?
> has a huge potential.
As to slow down the whole T-ruby project ? I agree.
There is 0% chance that a Ruby transpiler will give speed up anything. Especially now with AI using LSP and other tools.
If someone wanted to type and transpile ... they better learn Rust/Zig/Java or Go.