> You’re right, I overgeneralized. Let me correct myself:
> 
> From what I’ve seen so far [*], using extensions for "code organization" 
> often results in spaghetti code.
> 
> [*] Observed as a contractor; iOS platform; average Joe's code.


Fair :-)

Another use case for extensions I had forgotten about that I have used 
extensively, however, is using to group private or public members together, and 
have the access control level of the extension apply to each member in the 
extension (by default). Typically, I’ll declare the properties and initializers 
in the main type declaration, and then all public methods I’ll place in a 
“public” extension, and all private methods I’ll place in a “private” 
extension. This IMO is a great win for code readability, and another thing that 
I have lost the ability to do without using file private.

> On Apr 17, 2017, at 1:04 AM, Rudolf Adamkovič <[email protected]> wrote:
> 
> On 17 Apr 2017, at 01:46, Riley Testut <[email protected]> wrote:
>> 
>> So while you personally may not use extensions, calling the use of them 
>> "spaghetti code" is rather misguided IMO.
> 
> You’re right, I overgeneralized. Let me correct myself:
> 
> From what I’ve seen so far [*], using extensions for "code organization" 
> often results in spaghetti code.
> 
> [*] Observed as a contractor; iOS platform; average Joe's code.
> 
> Thanks!
> 
> R+
> 

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to