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…
Ruby 3.4 Highlights
31–40 of 86 posts
Re: Ruby 3.4 Highlights
#32Earlier 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
Re: Ruby 3.4 Highlights
#33The 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.
Re: Ruby 3.4 Highlights
#34Ruby 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
#35Is 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.
Re: Ruby 3.4 Highlights
#36Is 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.
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
#37The 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
#38The 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
#39> 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.
Re: Ruby 3.4 Highlights
#40I 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.