May I revive this idea for a discussion. 

When I posted this first I didn’t thought about creating these nested types 
inside extensions.

So basically I could do this (over and over):

extension SomeClass {
   class NestedClass { … }
}

But we have to surround a new nested type by an extension scope which is more 
boilerplate to my eyes than just `class SomeClass.NestedClass` instead.

Is this worth a proposal?

-- 
Adrian Zubarev
Sent with Airmail

Am 12. Mai 2016 bei 16:04:23, Adrian Zubarev ([email protected]) 
schrieb:

As you may know we can nest types for shiny namespacing (protocol nesting might 
follow in Swift 3 as well).

What if we could create Types separated by a `.` character to determine that 
this is a nested type to stop building type pyramides, which could be/look ugly 
in some cases.

Imagine SomeClass and NestedClass are some huge and complex types. It might 
become hard to read if we had to build them in place just for good namespacing.

class SomeClass {
   class NestedClass {
      enum Error {}
   }
   enum Error {}
}

Split this to something like this:

class SomeClass {}

enum SomeClass.Error {}

class SomeClass.NestedClass {
    enum Error {} // nesting is still allowed
}

Extensions already allow that.

extension SomeClass.NestedType {}

What do you think? Is it something for Swift 3?

-- 
Adrian Zubarev
Sent with Airmail
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to