I don't understand the change of the default block parameter name. It's already _1, _2, etc. Why create yet another, backward-incompatible way? And still, they doom march forward with the fragmentation of rbs and sorbet/tapioca, rather than adopting in-band gradual typing like Python did. I think the greater problem is Ruby appears to be developed by a nearly-closed small clique of people who refuse to listen to othe…
Ruby 3.4 Highlights
81–86 of 86 posts
Re: Ruby 3.4 Highlights
#82I know Shopify has a great site on comparing Ruby vs YJIT perf. https://speed.yjit.org But does anyone have current numbers on how Ruby/YJIT compares to something like Python/PHP/LuaJIT?
The Computer Language Benchmarks Game has some compared benchmarks: Ruby+YJIT vs Python: https://benchmarksgame-team.pages.debian.net/benchmarksgame/... Ruby+YJIT vs PHP: https://benchmarksgame-team.pages.debian.net/benchmarksgame/... Ruby+YJIT vs Lua: https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
Re: Ruby 3.4 Highlights
#83The default block parameter name seems small, but I feel like I'm gonna use it all the time, especially when I'm in the Rails console just trying to debug data
items.map { foo(_1) }
items.map { foo(it) }Re: Ruby 3.4 Highlights
#84I don't understand the change of the default block parameter name. It's already _1, _2, etc. Why create yet another, backward-incompatible way? And still, they doom march forward with the fragmentation of rbs and sorbet/tapioca, rather than adopting in-band gradual typing like Python did. I think the greater problem is Ruby appears to be developed by a nearly-closed small clique of people who refuse to listen to othe…
I agree that `it` is unnecessary, but I'm really confused by the push for a type system. It adds a lot of clutter to a language that optimizes for expressiveness. I would prefer to work in something like Go, which is designed to have types, rather than awkwardly patch them into Ruby.
Re: Ruby 3.4 Highlights
#85Earlier quoted context omitted.
I agree that `it` is unnecessary, but I'm really confused by the push for a type system. It adds a lot of clutter to a language that optimizes for expressiveness. I would prefer to work in something like Go, which is designed to have types, rather than awkwardly patch them into Ruby.
Apples (dynamic language) vs. oranges (static languages). Python's gradual typing approach solved this problem similarly to TypeScript, which is the right way to do it: https://peps.python.org/pep-0483/
Re: Ruby 3.4 Highlights
#86I'm pleasantly surprised to see this improvement: Tempfile.create(anonymous: true) removes the created temporary file immediately. So applications don’t need to remove the file. [Feature #20497] I use a similar pattern a lot : file = Tempfile.new.tap(&:unlink) file It's a neat trick to leverage the filesystem for large amounts of data (e.g. "psql \copy" generation), without littering tempfiles everywhere. Once the la…