If such code is difficult to debug or to inspect its types, the tooling is deficient.
I very much do not agree that supplementary tooling should drive the way in which we express programs, and in fact my feeling is the complete opposite. If forEach
is a more appropriate fit for a developer's particular circumstance, they should use it as much as they like. There should be a constant pressure on tooling to improve and meet the needs and preferences of contemporary developers.
Ultimately Swift is supposed to support all programming styles. If developers want to use forEach
, I say we give it to them, gladly, and that we do not suggest that they might be "holding it wrong".