Live data from Hacker News

Ruby 4.0.0

ruby-lang.org

151–160 of 197 posts

Re: Ruby 4.0.0

#151

Earlier quoted context omitted.

In my honest opinion, if you can't live without static typing, Ruby just isn't for you. Adding static typing to a dynamic language mostly gives you the disadvantages of both, without a lot of benefits. It's better to stick to languages that were designed with static types from the start. I love programming in Ruby, having to worry about type annotations and the additional constraints that come with them would take a…

> Adding static typing to a dynamic language mostly gives you the disadvantages of both, without a lot of benefits. Can you elaborate? I don't share this experience, and I'm interested in bringing static typing to a language without static typing, so I'd like to understand. In new Python and JavaScript codebases, optional typing has had clear benefits for refactoring and correctness and low costs for me. Legacy codeb…

I don't have a great code example at hand unfortunately, but I found that people often tend to write more "nominally" typed code (expecting explicitly named classes) rather than taking advantage of duck typing (interfaces, structural types), meaning the code becomes more rigid, harder to change and more time wasted on resolving all the type checks, even if the code otherwise is perfectly reasonable and free of bugs.

In other words, I found that the resulting code often looked more like Java but with weaker guarantees about types and much worse performance.

Re: Ruby 4.0.0

#152

Earlier quoted context omitted.

This year I also switched from Ruby to Kotlin on my hobby/light commercial backends. I just can't stand the way Ruby is not statically typed, and the resulting insecurity around if everything is actually doing what it should do. Kotlin gives me joy, and performance is actually better (trading memory requirements ofcourse, but that's not a big problem anymore). I still love Ruby, but only use it for simple scripts now…

This has sort of been my issue with Elixir. I've been doing Scala for years but I think Phoenix is really the best web story at the moment for how I want to be building web apps. And while I believe that the benefits of static typing somewhat decrease in the web arena, it's still frustrating to have to manage type relationships in my head. I'm hopeful that the incoming type system work makes me happier there, though…

> I believe that the benefits of static typing somewhat decrease in the web arena

I’ve seen this sentiment expressed numerous times and have never found it to be true in my own work (e-comm), do you mind mentioning _what_ type of domain your web apps are in?

Edit: or if not domain, what do you mean by “web arena”

Re: Ruby 4.0.0

#153
post #79

Happy bday ruby! For the usual doomsdaysayers saying "ruby can't X so I left it for Y", when X is typing, RBS is becoming the accepted standard (now that sorbet supports it),and RBS inline notation next to signature/code too (for peeps complaining about separate files); when X is LSP, ruby-lsp is the standard and already supports "go to definition" (its major hole for a long time), and its plugin architecture allows…

It’s just inferior to Python, nobody is making a more complex argument than that. Why ever use Ruby when there’s a virtually identical system that’s faster with a bigger community.

Ruby/rails has always felt fragile to me. Like you have to write the same tests over and over to make up for the looseness of it, not to mention the culture of breaking changes adds insult to injury. Just seems like a mess and the nice syntax (subjectively) isn't nearly enough to win when better options exist.

Re: Ruby 4.0.0

#155
post #70

I'm happy to see v4.0, but 2025 was the year I switched from Ruby to Python after gradually drifting back to it more and more. The tipping point was when I had Claude Code automatically convert one of my Ruby projects to 100% Python - and after that, I just had no Ruby left. I spent over a decade enjoying Ruby and even wrote a book about it. At this point, though, Python has won for me: fastapi, pytorch, langchain, s…

> fastapi, pytorch, langchain, streamlit, and so on and on It's telling that your reasons for switching are all features of Python's ecosystem, not of the language itself. A lot of developers are moving to Python because of its libraries, and in many cases they don't care for the language at all. That's causing a problem for Python: many of these developers who'd rather be using different languages seem to want to mo…

> It's telling that your reasons for switching are all features of Python's ecosystem, not of the language itself.

Right, because ecosystem beats syntax any day of the week. Plus many of us also think the Python language is nicer anyway. For me I can't get past Ruby's free wheeling approach to import scoping and tolerance for magic.

Re: Ruby 4.0.0

#156

Earlier quoted context omitted.

I think it will need to be a strong 3rd party that basically gives it the Typescript treatment. Adds type annotations to the core language syntax. The compiler does type checking, strips the annotations, and outputs plain Ruby.

Sorbet is backed by Stripe. Why is it important to be a separate layer that compiles to plain untyped Ruby?

So that it doesn’t have to go through the Ruby development process. Matz doesn’t want it, and even if he did it would take years just to get people to agree on a syntax, much less actually get it implemented and rolled out.

Same reason Typescript was made and we didn’t add types to JavaScript.

Re: Ruby 4.0.0

#157
post #152

Earlier quoted context omitted.

This has sort of been my issue with Elixir. I've been doing Scala for years but I think Phoenix is really the best web story at the moment for how I want to be building web apps. And while I believe that the benefits of static typing somewhat decrease in the web arena, it's still frustrating to have to manage type relationships in my head. I'm hopeful that the incoming type system work makes me happier there, though…

> I believe that the benefits of static typing somewhat decrease in the web arena I’ve seen this sentiment expressed numerous times and have never found it to be true in my own work (e-comm), do you mind mentioning _what_ type of domain your web apps are in? Edit: or if not domain, what do you mean by “web arena”

I find that if most of my logic is relatively gluey, then the fields in my API boundaries are heavily optional, at which point types add a lot less than they do when most of my logic is more internal, and in cases where what I'm doing is just getting some JSON and doing something with it, I'd rather just have the dynamic shape of the JSON in a lot of cases than have to declare an entire schema/codec.

We have so much boilerplate and tooling to share request/response types between services and it's just... heavy. The same feeling arises when I'm sitting here trying to share a shape between a web app and the backend service, where FINALLY I just want the types to get out of my way instead of having to go through all this ceremony.

And my domain is relatively precise and typeable - streaming video with a deterministic set of parameters.

Generally though I'm more likely to agree with the value of types than to undersell them; I just can't find a ways to describe the above experiences such that they reflect that perspective.

I think it's not that I don't want types, it's that I want simple types that play slightly more dynamically - maps of , for example, and reasonable means of interacting with them (like various "safe traversal" operators that some languages have added).

Re: Ruby 4.0.0

#158

Ruby is amazing. I recently built a layer on top of Rails that can generate an API from a single markdown file. I did the same thing in python but it was much harder and JavaScript would have been a beast. Ruby can meta program like nothing else.

Try Clojure. Macros make method_missing look primitive.

Re: Ruby 4.0.0

#159

I haven't looked at Ruby for a long time. I've moved away due to the lack of typing. Any degree of typing would be helpful. Does it support typing yet?

There’s projects trying to implement it. But I’ve never seen a project using typed Ruby. I think most people who cared just moved to typescript.

Stripe is using typed Ruby: they are authors of https://github.com/sorbet/sorbet

Re: Ruby 4.0.0

#160

Earlier quoted context omitted.

There’s projects trying to implement it. But I’ve never seen a project using typed Ruby. I think most people who cared just moved to typescript.

Stripe is using typed Ruby: they are authors of https://github.com/sorbet/sorbet

Also: lots of other big Ruby shops are on Sorbet, like Figma, One Medical, Gusto etc. We discussed this at the SF Ruby meetup after this talk https://www.rubyevents.org/talks/past-present-and-future-of-...
Post reply on HN