6 ms·
‘it’ is a welcome addition!
by evjan 2y ago
‘it’ is a welcome addition!
- ciconia 2y agoDon't say that word! https://www.youtube.com/watch?v=RZvsGdJP3ng https://www.youtube.com/watch?v=RZvsGdJP3ng
- ilvez 2y agoTruly is, much nicer than that lonely `_1`
- rubyfan 2y ago_2 can be as bad as _1
- BoingBoomTschak 2y agoI'd have thought allowing _ as a synonym for _1 would have been more aesthetically consistent. That's the path I went with when designing my CL #λ reader macro, personally.
- JasserInicide 2y agoI 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.
- Trasmatta 2y ago`arr.map { it.thing.blah.stuff }` The `&:` doesn't work in that context
- ilvez 2y agoNot to point any fingers, but shows that the previous commenter have not struggled with this :) &: is very nice, but not enough.
- graypegg 2y agoThat 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
- zachrose 2y agoDoes `it` conflict with Rspec's `it`? Surely they've thought of this, but to my eye it looks like it would get confusing.
- prh8 2y agoNope it doesn’t, they did take that into account during development.