Josh, can you post an example of a case where you find a trailing closure to be unclear? I'm just not seeing it.
I don't find trailing closures unclear. Rather, when I am reading unfamiliar code that uses trailing closures for functions I don't already know by heart, I would prefer to see argument labels as clues for what the closures do. This does not apply to well-known functions like map
, forEach
, and sync
.
Named parameters are one of my favorite features of Objective-C and Swift. I spent many hours in the late 90s chasing bugs in C code caused by inadvertently swapped parameters.
As an aside, Java also lacks named parameters, but the IntelliJ IDE shows parameter names inline.
After a curiously long gestation period, the blog post is complete. Many thanks to those who replied to my inquiry. Trailing Closures ยท Race Condition
3 Likes