News for hackers. Stuff that matters.
Re:Ruby 3.4.0 by JasserInicide on Wednesday December 25, 2024 @08:57AM (#42508785)
I don't understand the point of it when the `.map(&:upcase)` syntax is shorter. This just seems like yet another syntactic sugar Rubyism that doesn't really add anything.

If it's an alternative to the `|x|` syntax when using only one block variable, then I like that.

Re:Ruby 3.4.0 by graypegg on Wednesday December 25, 2024 @09:00AM (#42508798)
That only works when calling a method on the things you’re iterating thru, it is a replacement for the single variable block example you gave there
Re:Ruby 3.4.0 by Trasmatta on Wednesday December 25, 2024 @09:10AM (#42508840)
`arr.map { it.thing.blah.stuff }`

The `&:` doesn't work in that context

Re:Ruby 3.4.0 by ilvez on Wednesday December 25, 2024 @01:25PM (#42510254)
Not to point any fingers, but shows that the previous commenter have not struggled with this :)

&: is very nice, but not enough.