Earlier quoted context omitted.
It's good practice to use irb to quickly check stuff or inspect the programmatic surface of a new library. But that's a Ruby feature that you don't have in other languages! In no way its mandatory to code inside irb. Most of my time was spent in Textmate or Emacs.
A REPL such as irb is by no means unique to Ruby. Even many statically typed compiled languages have them these days.
Ruby 3.2’s YJIT is Production-Ready
261–270 of 304 posts
Re: Ruby 3.2’s YJIT is Production-Ready
#262Earlier quoted context omitted.
I used to have that attitude. Then I wrote my first Ruby project as an experiment. That was 17 years ago, and the majority of the code I've written since has been Ruby. What clinched it was that the first Ruby project I wrote involved trying to reimplement a piece of C code we had. It ended up 10% the size with more functionality, and it took me a tiny fraction of the time to write. If you write code the way you writ…
Have you looked into Crystal? It's supposed to be a statically-typed language, with the syntax of Ruby. https://en.wikipedia.org/wiki/Crystal_(programming_language)
Re: Ruby 3.2’s YJIT is Production-Ready
#263I've set this up in a staging environment of one of our apps to take a look. The staging environment we use for one-offs is on Heroku (can stand one up/down quickly), and the first issue is that a lot of the 'easy to deploy is a feature' PAAS platforms is that they bill by web/worker size restricted by memory rather than just pure virtual CPU power. Render etc all does this as well, and the memory headrooms are low.…
Re: Ruby 3.2’s YJIT is Production-Ready
#264Earlier quoted context omitted.
When I write Ruby, I test expected behaviours, and if there are type errors in there those tends to fall out from tests I needed anyway. If you need to test specifically for errors due types, then generally that suggests that either your application does not normally exercise those code paths at all and/or you fail to test behaviours of your application.
Does this include writing libraries for use by third-parties?
Sure, test for sane failure modes in line with the documented contract, and that may include the occasional test that is de facto a type test, but often testing for types, especially in languages with poor type systems, but also in Ruby where we have alternatives, ends up with tests for classes which is frequently the wrong thing.
E.g. in Ruby never, ever check for somearg.kind_of?(IO) if all you ever do is somearg.read - if you absolutely must typecheck somearg, the Ruby way is to check for presence of "#read", e.g. somearg.respond_to?(:read), or try and fail responsibly (and often just allowing the NoMethodError to bubble up is the right way to fail).
Also think it's just fine for people to add and ship Sorbet type declarations for gems etc. to then signal those contracts so people can verify them if they choose. There's no reason not to offer that when it's reasonable to do so.
Re: Ruby 3.2’s YJIT is Production-Ready
#265Earlier quoted context omitted.
I used to have that attitude. Then I wrote my first Ruby project as an experiment. That was 17 years ago, and the majority of the code I've written since has been Ruby. What clinched it was that the first Ruby project I wrote involved trying to reimplement a piece of C code we had. It ended up 10% the size with more functionality, and it took me a tiny fraction of the time to write. If you write code the way you writ…
C is barely statically typed. In an ML-family languge you can write pretty much the same code you'd write in Ruby, just it'll be typesafe.
But keep in mind this includes run-time dynamic meta-programming. E.g. one of my projects bootstrapped a large proportion of the web frontend by having the backend introspect the database schema and dynamically generate models, routes, access control and metadata endpoints that the frontend then used to instantiate the UI.
The typing in that case was controlled by the database migrations.
Re: Ruby 3.2’s YJIT is Production-Ready
#266Earlier quoted context omitted.
Oh, it does. It just happened back when Python and Ruby were new and hot. These days, Rust is new and hot, and so ...
I do remember dumping on Java back in those days, not so much on static typing itself. Seems like those were mostly language wars: Python vs PHP, Python vs Java, Ruby vs PHP, etc. It might be just anecdotal, but I noticed people often say that writing in Ruby makes them feel happy . Static typing (or functional programming, or TDD) doesn't seem to make people happy. It makes them feel superior . Whether it truly make…
These days more inferred typing in many of the static languages has lessened the gap, so the reason to hate on them has been reduced.
I still would love better static analysis tools, including for Ruby, but at the same time the way I write code has changed drastically in ways that makes that harder (e.g. leveraging the dynamic features of Ruby more)
Re: Ruby 3.2’s YJIT is Production-Ready
#267Can someone 'explain it like I'm 5' why someone would just JIT instead of compiled Ruby, or even what the difference is please.
That means there is no need to write a fully-featured Ruby compiler, instead you only have to emit native code in places/situations where it will have the maximum benefit.
Re: Ruby 3.2’s YJIT is Production-Ready
#268Earlier quoted context omitted.
I don't know if I'm just a bad programmer and everyone knows something I don't, but it seems to be the benefits of a strongly typed language are wildly overblown. It's a different way of thinking about building software and it saves you from a few mistakes you could otherwise make, but you'd think I was writing code with a hammer and chisel the way people on HN talk about languages like Ruby. It feels a lot like the…
It comes down to project size. Small projects with a small team tend to be fine. Bigger ones tend to break down a bit and the application becomes ossified because there's no safety when changing things. You can power through it but productivity takes a nose dive. The big ones that stay on Ruby tend to invent typing like things to solve the issue.
I've certainly seen that happen in Ruby, but I've also seen that happen in every other language - most of them statically typed - I've worked with, as very few languages have type systems expressive enough to prevent it (and it tends to massively destroy productivity to try check everything strictly enough anyway).
Re: Ruby 3.2’s YJIT is Production-Ready
#269Can someone 'explain it like I'm 5' why someone would just JIT instead of compiled Ruby, or even what the difference is please.
See Natalie [0] for a work-in-progress Ruby compiler which works ahead of time. It’s a super cool project but it’s just for fun [1] so I don’t believe it’s trying to compete on performance.
Re: Ruby 3.2’s YJIT is Production-Ready
#270Earlier quoted context omitted.
Tragically, one of the principals behind TruffleRuby (and researcher at Shopify) was Chris Eaton and he passed away a few months ago. I'm not sure where this leaves TruffleRuby itself, or plans to implement it at Shopify. (Rest in peace, Chris, and may your memory be a blessing to those who knew you)
Chris Seaton