// this reads well
array.first(where: { criteria })
// but this is not at all clear
array.first { criteria }
I agree, second one isn't good. Thankfully we can write it the first way!
There is a solution in place already, so why do we have to change the stdlib?
I don't see how firstWhere(...)
is more readable than first(where: ...)
.
I don't understand why this. Some labels are useful enough to include it in your code. Some labels are not. That's why I include some of the labels in my code, and don't include some of them. For example I when I call first(where:)
function, I always write the label down.
Current situation:
+----------------------------------+
|Is the label meaningful enough |
|to include it in your source code?|
+----------------------------------+
| |
| |
Yes |
| No
v |
Include it in your source code |
v
Skip it
What you are suggesting:
+----------------------------------+
|Is the label meaningful enough |
|to include it in your source code?|
+----------------------------------+
| |
| |
Yes No
| |
V V
Include it in your source code
Would that be better for people that think that these labels are useful? I don't think so, they should be writing them already. Would that be better for people that think that these labels should be skipped? I don't think so, you would be forcing them to go against what they want.
I feel like Require parameter names when referencing to functions is a better solution for that. Renaming specific functions one by one doesn't solve the root of the problem.