-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PROPOSAL] Aliases for methods traverse_
and sequence_
#4611
Comments
Normally I hate having multiple words for things but… yeah, the underscore variants are really weird, particularly for something so commonly used. Agreed this is worth fixing. Also we've done this in a few places in Cats Effect as well, perhaps most notably |
As of my two cents, technically, that underscore postfix has been well-recognized and has influenced the whole ecosystem (not only the Typelevel one). We shouldn't give up on it, for sure.
|
Personally, I think While Discard is also possibly nice, but if we go down that road, I think we want In summary, my vote would be that making traverseVoid as an alias for traverse_ would be a positive move without introducing a larger question of re-litigating |
I like Here's my question: do we deprecate the old and create toil, or live with the duplicate names until the heat death of the universe and/or Cats 3? |
I think we can arrange something in the middle. For example:
A plan like that might work, I guess. |
I think it's possible to offer a scalafix rewrite that could even be applied by scala-steward. This could be done together with deprecating the old methods. |
Agree, a scalafix rule could come in handy indeed. I would suggest though to address it in a separate follow-up PR, i.e.:
Just to let the aliases go live without awaiting the rewrite to come out. I feel we can expedite the whole process that way. That said, I also feel that in this particular case for many users it could be way easier to do a simple "find-and-replace" across their projects rather than bother with scalafix. Especially if there's no automated process of applying scalafix rules in there (which I bet many real-world projects don't have). |
Since
fa.traverse_(fun)
andfa.sequence_
are semantically the same asfa.traverse(fun).void
andfa.sequence.void
I would propose to add aliasestraverseVoid
andsequenceVoid
for them correspondingly.Why?
In two words: discoverability and clarity.
The names
traverse_
andsequence_
look cryptic and not self-explaining at all.I personally witnessed guys who were relative new to Cats and they were able to figure out regular
traverse
andsequence
theirselves but were struggling with thetraverse_
andsequence_
variants. Most likely this is because across the industry underscores in method names are often used to mark some kind of internal/system API which should not be normally in use.The text was updated successfully, but these errors were encountered: