[swift-evolution] Proposal: Define and call a named nested function in one step.

Brent Royal-Gordon brent at architechies.com
Wed Feb 17 17:15:22 CST 2016


> Also, if a cyclomatic complexity tool treats nested functions as if they were not nested, then you would get a lower cyclomatic complexity for the containing function with my proposal than with a labeled do.

If you're defining a function in the middle of a chunk of code, calling it, and continuing with more code after the call, that function is not really reducing the complexity of your code.

(That is, defining a nested function at the top or bottom of its containing function, and then using it somewhere in the middle, does make your code easier to understand. Defining it in the middle at the site where it's called doesn't.)

-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list