Live data from Hacker News

Ruby 3.4 Highlights

blog.sinjakli.co.uk

31–40 of 86 posts

Re: Ruby 3.4 Highlights

#31
post #12

Is ruby used outside of web dev (i.e., Ruby on Rails)? it seems like a nice cute language but I almost never hear about it.

At my day job we use Ruby with Sorbet to stitch together a large number of data engineering pipelines. It's a good choice since we also often stand up small Rails apps to expose the results from those pipelines, so we can keep everything in one language. The fluent functional approach it enables is pretty nice for that business logic (but I would not want to do it without the gradual typing on top). We do find oursel…

Oh nice! I haven't used Sorbet yet, but this is the second time I've heard good things about it outside of Stripe (where it originated). I'll have to give it a proper look.

Re: Ruby 3.4 Highlights

#32
post #18

Earlier quoted context omitted.

I wish I could reach for Kotlin as a kind of "Ruby with typing out of the box" but the lack of a good REPL is a real dealbreaker.

You'll get Ruby with typings soon when rbs-inline is finalized

Ooh, I hadn't heard of rbs-inline before. I was always a bit put off by the type definitions having to live in separate files.

Re: Ruby 3.4 Highlights

#33

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

I constantly run into situations where I need to nest an iterator computation, and things like "it" get confusing. I'm all for adding language features to avoid boilerplate, and it's clearly useful. I just want to call out that anonymous typing can be polarizing in large codebases and maybe only use it sparingly.

I doubt I'll use it in committed code very often at all, this feels more like something that's very useful when hacking at something in the REPL

Re: Ruby 3.4 Highlights

#34
The author also forgot to mention that the new error output doesn't mix ` and ' anymore.

Ruby 3.3

> 'asd' + 1 (sitar-report):1:in `+': no implicit conversion ...

Ruby 3.4

> 'asd' + 1 (sitar-report):1:in 'String#+': no implicit conversion...

Re: Ruby 3.4 Highlights

#35

Is ruby used outside of web dev (i.e., Ruby on Rails)? it seems like a nice cute language but I almost never hear about it.

Yeah, I use it for everything between 5-lines-of-bash and a needs-a-compiled-language. You almost never hear about it, because it's mature. No big controversies, no huge fuckups or new versions that break everything, just a steady trickle of improvements.

I am happy in this moment because as I lay here with my ear on the ground, I can hear many many people hearing about Ruby

Re: Ruby 3.4 Highlights

#36

Is ruby used outside of web dev (i.e., Ruby on Rails)? it seems like a nice cute language but I almost never hear about it.

Ruby is my go to language for short "fun" programs, as there are many places where it optimized for development experience (such as the new "it" feature). One of the committers, Yusuke Endoh, clearly understood the joy of coding in itself as opposed to being means to an end, and has authored a book on esoteric programming:

https://www.amazon.co.jp/dp/4774176435

Before Ruby, my preferred fun language was Perl. Ruby is like Perl but without having to type $ all the time. I have never used Rails.

Re: Ruby 3.4 Highlights

#37

The author also forgot to mention that the new error output doesn't mix ` and ' anymore. Ruby 3.3 > 'asd' + 1 (sitar-report):1:in `+': no implicit conversion ... Ruby 3.4 > 'asd' + 1 (sitar-report):1:in 'String#+': no implicit conversion...

This has bothered me for decades, why was this ever the case to begin with?

Re: Ruby 3.4 Highlights

#38

The author also forgot to mention that the new error output doesn't mix ` and ' anymore. Ruby 3.3 > 'asd' + 1 (sitar-report):1:in `+': no implicit conversion ... Ruby 3.4 > 'asd' + 1 (sitar-report):1:in 'String#+': no implicit conversion...

Is the stack trace in the section "Clearer exception backtraces" actually from 3.4? It has mixed backticks and single quotes.

Re: Ruby 3.4 Highlights

#39
post #7
post #3

> In Ruby 3.4, it has been added as a default name for the first parameter passed to a block. Rather than specifying a name in trivial cases like the one above, you can now write: > [ > "beige chinos", > "blue jorts", > "rainbow jorts", > ].filter { it =~ /jorts/ } > # => ["blue jorts", "rainbow jorts"] This reminds me of Perl's $_ (which in Ruby is last line read from STDIN).

I am familiar with ‘it’ as a default closure input from Kotlin. From a quick search, that in turns seems to be inspired by Groovy.

This goes at least as far back as anaphoric macros: https://en.m.wikipedia.org/wiki/Anaphoric_macro.

Re: Ruby 3.4 Highlights

#40

I happen to be reading the latest edition of the pickaxe book, as I'll soon be using Ruby at work (first experience) and this 'it' update sounds so much better than the _1 described in the book. I remember thinking it clashed a bit with the idea of trying to make the code read like natural language.

_1 is also a bit of a footgun. It becomes an array of all block params IF the block has an arity > 1 AND no other block param (e.g. _2) is referenced anywhere within the block. It's an unusually half-baked feature by Ruby's standards. I think there was some hesitation about the name "it" initially, because "it" is an essential method name in rspec, and is used within blocks there.

I pity anyone needing to debug a fiddly Rspec problem in the next few years.
Post reply on HN