Live data from Hacker News

Ruby 3.4 Highlights

blog.sinjakli.co.uk

81–86 of 86 posts

Re: Ruby 3.4 Highlights

#81

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…

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

#82
post #72

I 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/...

And for an appearance of comparability the "#8" programs are un-optimised single-thread transliterated lowest-common-denominator style into different programming languages from the same original.

https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

Re: Ruby 3.4 Highlights

#83

The 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

We already had "_1", "_2", etc., for inline block arguments. Adding "it" increases the surface area of the language without adding any new functionality. I think the underscored names are actually better for readability. They jump out at me, while "it" looks like every other variable name.

  items.map { foo(_1) }
  items.map { foo(it) }

Re: Ruby 3.4 Highlights

#84

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…

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

#85

Earlier 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/

It may be less bad, but I don't think there's a right way to retroactively add a type system to a dynamic language. I generally like working in JavaScript, but I have no desire to ever see TypeScript again.

Re: Ruby 3.4 Highlights

#86

I'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…

This is available in older Ruby versions by using the upstream `tempfile` gem version.
Post reply on HN