News related to several Crystal block arguments discussions:
Ruby 2.7 introduces numbered parameters for blocks https://medium.com/@baweaver/ruby-2-7-numbered-parameters-3f5c06a55fe4
TLDR
[1, 2, 3].map { @1 + 3 }
=> [4, 5, 6]
Not that I like it, but it’s similar to Kotlin’s it
: [1, 2, 3].map { it + 3 }
and also not limited to the only block argument use case.
Although examples look weird:
(1..9).each_slice(3).map { @1 + @2 + @3 }
=> [6, 15, 24]
[{name: 'foo'}, {name: 'bar'}].map { @1[:name] }
=> ["foo", "bar"]