[swift-evolution] [Pitch] Nesting types without nesting in place (additional)

Adrian Zubarev adrian.zubarev at devandartist.com
Thu May 12 09:04:20 CDT 2016

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160512/e37bc432/attachment-0001.html>

More information about the swift-evolution mailing list