Earlier quoted context omitted.
You'll get Ruby with typings soon when rbs-inline is finalized
Is that really something that's been slated to be added to the language proper? I attended RubyConf and in his keynote Matz seemed pretty opposed to adding types to Ruby source, and argued in favor of automatic typing instead.
Ruby 3.4 Highlights
51–60 of 86 posts
Re: Ruby 3.4 Highlights
#52Is 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.
Re: Ruby 3.4 Highlights
#53Earlier quoted context omitted.
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.
nested_example = [1, 2, 3, 4, 5].map do [it, (1..it).map { it * it }] end Has an ambiguity, so you just add |x| to one of them.. nested_example = [1, 2, 3, 4, 5].map do |x| [x, (1..x).map { x * it }] end Seems like a mental over complication of a non-issue to me.
Re: Ruby 3.4 Highlights
#54The 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
Also damn Nim needs to do a much better job with their docs and site. `nim result` returns this very outdated third-party link first and nothing else official.
Re: Ruby 3.4 Highlights
#55Is 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.
Re: Ruby 3.4 Highlights
#56Earlier quoted context omitted.
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.
nested_example = [1, 2, 3, 4, 5].map do [it, (1..it).map { it * it }] end Has an ambiguity, so you just add |x| to one of them.. nested_example = [1, 2, 3, 4, 5].map do |x| [x, (1..x).map { x * it }] end Seems like a mental over complication of a non-issue to me.
Re: Ruby 3.4 Highlights
#57Earlier quoted context omitted.
_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.
Re: Ruby 3.4 Highlights
#58Earlier quoted context omitted.
Kotlin also has it, I can tell you that it's really useful
Ruby has had this in the same form as "_1" for a while (and the obvious other indexes in the case of multiple params), but I agree Kotlin's "it" reads much better.
Re: Ruby 3.4 Highlights
#59The 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
Re: Ruby 3.4 Highlights
#60Earlier quoted context omitted.
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