Uploaded image for project: 'Swift Driver'
  1. Swift Driver
  2. SWIFT-152

Consider making library classes final by default

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Open
    • Priority: Major - P3
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      Before tagging a 1.0 release, I'd suggest examining if library classes can/should be final by default. I was reading up on this as it relates to Swift, and it looks like "final by default" was being actively discussed a while back as a potential language feature but nothing came of it. That said, I do think it has merits in a library as it promotes a design pattern of composition over inheritance. This also goes hand in hand with erring on the side of a minimal public API and only making things accessible when necessary.

      From Kotlin's documentation on Classes and Inheritance:

      By default, all classes in Kotlin are final, which corresponds to Effective Java, 3rd Edition, Item 19: Design and document for inheritance or else prohibit it.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            jmikola Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated: