I think a standard method should exist for this
In https://github.com/crystal-lang/crystal/pull/3815#issuecomment-269978574 you can find an explanation about why it is preferred to return nil instead of self for #each.
@bcardiff I don't mind having nil #each, my propose is to add another method like each_and_self, so one doesn't tap &.each every time or even writes his own method.
BTW, now I see that tap &.each is short enough :thinking:
UPD: Okay, I'm totally alright with tap &.each, but this can be confusing for former Rubyists like me...
@vladfaust ok, I didn't understand that you were proposing and addition. I agree that tap &.each is short enough.
Maybe the actionable here is to add an iteration section in https://github.com/crystal-lang/crystal/wiki/Crystal-for-Rubyists .
I believe that this issue should be closed, tap is OK.
I added a section to Crystal for Rubyists: https://github.com/crystal-lang/crystal/wiki/Crystal-for-Rubyists#each-returns-nil
thx @Fryguy
Most helpful comment
I added a section to Crystal for Rubyists: https://github.com/crystal-lang/crystal/wiki/Crystal-for-Rubyists#each-returns-nil