Thanks for your reply, Kyle!
I don't see that I had to make a choice. I did locate a parameter with function type at the end of the parameter list. That's what { ... } is. There's also substantial fluency.
Let me ask the question differently. Presumably SE-0279 doesn't let you use trailing closure syntax for the where: parameter in my example because of the non-closure parameters that come after it(?). But now let's say those parameters are defaulted, or just not present in the API:
muncher.chew(leaves, having: .jaggedEdges, where: { !$0.isRed }) {
...
}
With SE-0279, something like this becomes possible, right?
muncher.chew(leaves, having: .jaggedEdges) { !$0.isRed }
masticationCallback: { ... }
Is that now to be considered the preferred way to write the call because it uses all possible trailing closures, even though the predicate now occupies the âprimary closureâ position?
Alternatively, is the call to be considered poorly designed because it doesn't read well when used that way? The API was designed according to the old pattern, where the last parameter is the primary action. The new pattern says the second-to-last parameter is the primary action.
I suppose that the old usage could be said to fit both the old pattern and your proposed new pattern, with the where: parameter falling into parts 1-3. So If we can additionally find a way not to declare the old API design wrong/suboptimal, that would address my concern.
I don't see how defaults are relevant here. There's not necessarily a default for the where: parameter in my example.
I'm sure there are lots of suboptimal/inconsistent Swift APIs in the SDKs; we did an automated conversion and since then there have been some revisions, but it's a massive collection and there was limited time/resources. When I say âlegacy codeâ I mean APIs that were designed for Swift, explicitly intending to support the old pattern.