# Which (breaking) changes would you be willing to accept in a major language release? \[+ Feature wishes\]

**URL:** <https://forums.swift.org/t/which-breaking-changes-would-you-be-willing-to-accept-in-a-major-language-release-feature-wishes/59429>\
**Category:** Discussion\
**Created:** [August 3, 2022, 8:39am UTC](https://forums.swift.org/t/which-breaking-changes-would-you-be-willing-to-accept-in-a-major-language-release-feature-wishes/59429 "2022-08-03T08:39:23Z")\
**Posts on this page:** 13\
**Page:** 4

<div class="post-metadata">

**Author:** ![stevapple](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/stevapple/32/31979_2.png) [@stevapple](https://forums.swift.org/u/stevapple)\
**Post date:** [August 15, 2022, 11:31am UTC](https://forums.swift.org/t/which-breaking-changes-would-you-be-willing-to-accept-in-a-major-language-release-feature-wishes/59429/62 "2022-08-15T11:31:04Z")

</div>

I would feel better if we force the use of `fileprivate` over `private` when it’s actually available in the file’s scope. Cases like `private extension` reuses `private` keyword but provides `fileprivate` semantics instead, introducing unnecessary confusion and styling issues.

I’m personally satisfied with `fileprivate` (or `private(file)` as someone proposed), and I believe making the semantics clear at first glance is more important than eliminating keywords.

---

<div class="post-metadata">

**Author:** ![jjrscott](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jjrscott/32/12494_2.png) [@jjrscott](https://forums.swift.org/u/jjrscott)\
**Post date:** [August 15, 2022, 12:12pm UTC](https://forums.swift.org/t/which-breaking-changes-would-you-be-willing-to-accept-in-a-major-language-release-feature-wishes/59429/63 "2022-08-15T12:12:21Z")

</div>

> [@0xTim](#):
>
> Removing inheritance from the language (I'm only half kidding)

I agree, especially after re-reading [Default Protocol Implementation Inheritance Behaviour - The current situation and what/if anything should be done about it](https://forums.swift.org/t/default-protocol-implementation-inheritance-behaviour-the-current-situation-and-what-if-anything-should-be-done-about-it/28049) 😳

Is it there for anything other that Objective-C compatibly and references? I'd like to see both of those split off.

---

<div class="post-metadata">

**Author:** ![davedelong](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/davedelong/32/38708_2.png) [@davedelong](https://forums.swift.org/u/davedelong)\
**Post date:** [August 15, 2022, 2:52pm UTC](https://forums.swift.org/t/which-breaking-changes-would-you-be-willing-to-accept-in-a-major-language-release-feature-wishes/59429/64 "2022-08-15T14:52:10Z")

</div>

Yes, this would be fantastic.

Related, I would love to see exhaustivity checking possible for _structs_. I tend to prefer structs over enums for almost everything, but it would be nice if I could tell the compiler somehow that this is an "exhaustive" struct. Perhaps using `CaseIterable` or something?

---

<div class="post-metadata">

**Author:** ![tera](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/tera/32/38201_2.png) [@tera](https://forums.swift.org/u/tera)\
**Post date:** [August 15, 2022, 5:15pm UTC](https://forums.swift.org/t/which-breaking-changes-would-you-be-willing-to-accept-in-a-major-language-release-feature-wishes/59429/65 "2022-08-15T17:15:53Z")

</div>

What do you mean by "exhaustive" struct? When using in a switch statement? Please show an example.

---

<div class="post-metadata">

**Author:** ![davedelong](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/davedelong/32/38708_2.png) [@davedelong](https://forums.swift.org/u/davedelong)\
**Post date:** [August 15, 2022, 5:37pm UTC](https://forums.swift.org/t/which-breaking-changes-would-you-be-willing-to-accept-in-a-major-language-release-feature-wishes/59429/66 "2022-08-15T17:37:01Z")

</div>

```swift
public struct ServerEnvironment: Equatable, CaseIterable {
    public static let allCases = [.production, .qa, .dev]

    public static let production = ServerEnvironment(host: "production.example.com", name: "Production", ...)
    public static let qa = ServerEnvironment(host: "qa.example.com", name: "QA", ...)
    public static let dev = ServerEnvironment(host: "dev.example.com", name: "Development", ...)

    private init( ... ) { }
}

// elsewhere:
let environment: ServerEnvironment = ...
switch environment {
    case .production: // do something only for Production
    case .qa: // do something only for QA
    case .dev: // do something only for Development
}

```

The "exhaustive" bit is that I would not need a `default` case because I have handled every possible case as defined by the `CaseIterable` conformance. It is not possible for the user of `ServerEnvironment` to get anything except one of those three values.

---

<div class="post-metadata">

**Author:** ![DevAndArtist](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/devandartist/32/287_2.png) [@DevAndArtist](https://forums.swift.org/u/DevAndArtist)\
**Post date:** [August 15, 2022, 5:39pm UTC](https://forums.swift.org/t/which-breaking-changes-would-you-be-willing-to-accept-in-a-major-language-release-feature-wishes/59429/67 "2022-08-15T17:39:23Z")

</div>

Maybe this will be possible if we get something like `@const` and then the compiler could infer that from a `@const allCases` or something along the lines.

---

<div class="post-metadata">

**Author:** ![vegerot](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/vegerot/32/8978_2.png) [@vegerot](https://forums.swift.org/u/vegerot)\
**Post date:** [August 16, 2022, 11:52pm UTC](https://forums.swift.org/t/which-breaking-changes-would-you-be-willing-to-accept-in-a-major-language-release-feature-wishes/59429/68 "2022-08-16T23:52:50Z")

</div>

yeah the constexpr proposal(s) have been stuck for months now 😔

---

<div class="post-metadata">

**Author:** ![flowtoolz](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/flowtoolz/32/13358_2.png) [@flowtoolz](https://forums.swift.org/u/flowtoolz)\
**Post date:** [August 19, 2022, 2:10pm UTC](https://forums.swift.org/t/which-breaking-changes-would-you-be-willing-to-accept-in-a-major-language-release-feature-wishes/59429/69 "2022-08-19T14:10:20Z")

</div>

To answer your title: ALL OF THEM.

I put Swift's ability to evolve above everything else.

---

<div class="post-metadata">

**Author:** ![Dmitriy\_Ignatyev](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/dmitriy_ignatyev/32/11340_2.png) [@Dmitriy\_Ignatyev](https://forums.swift.org/u/Dmitriy_Ignatyev)\
**Post date:** [August 20, 2022, 7:50pm UTC](https://forums.swift.org/t/which-breaking-changes-would-you-be-willing-to-accept-in-a-major-language-release-feature-wishes/59429/70 "2022-08-20T19:50:53Z")

</div>

> [@abdel-17](#):
>
> How would you hash function types?

functions have mangled names, which can be used for hash value for example.

---

<div class="post-metadata">

**Author:** ![Dmitriy\_Ignatyev](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/dmitriy_ignatyev/32/11340_2.png) [@Dmitriy\_Ignatyev](https://forums.swift.org/u/Dmitriy_Ignatyev)\
**Post date:** [August 20, 2022, 8:00pm UTC](https://forums.swift.org/t/which-breaking-changes-would-you-be-willing-to-accept-in-a-major-language-release-feature-wishes/59429/71 "2022-08-20T20:00:38Z")

</div>

> [@davedelong](#):
>
> but I _intentionally_ do no support anyone else making a related type

You can currently achieve this in a way like:

```swift
public struct ConformanceLimiter {
  fileprivate init() {}
}

public protocol ClosedProtocol {
  var conformanceLimiter: ConformanceLimiter { get } // can not be constructed outside of the library
}

```

It is a bit ugly, but do the deal.

---

<div class="post-metadata">

**Author:** ![Rod\_Brown](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/rod_brown/32/425_2.png) [@Rod\_Brown](https://forums.swift.org/u/Rod_Brown)\
**Post date:** [August 21, 2022, 11:07am UTC](https://forums.swift.org/t/which-breaking-changes-would-you-be-willing-to-accept-in-a-major-language-release-feature-wishes/59429/72 "2022-08-21T11:07:29Z")

</div>

In this case you can implement the `conformanceLimiter` as a `fatalError`:

```swift
var conformanceLimiter: ConformanceLimiter {
    fatalError("I'm outside the file so I can't make one, but I can do anything else and conform")
}
```

---

<div class="post-metadata">

**Author:** ![jayton](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jayton/32/5592_2.png) [@jayton](https://forums.swift.org/u/jayton)\
**Post date:** [August 21, 2022, 5:42pm UTC](https://forums.swift.org/t/which-breaking-changes-would-you-be-willing-to-accept-in-a-major-language-release-feature-wishes/59429/73 "2022-08-21T17:42:04Z")

</div>

Alternatively, you can harvest a ConformanceLimiter from one of the library’s own types and return that.

---

<div class="post-metadata">

**Author:** ![davedelong](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/davedelong/32/38708_2.png) [@davedelong](https://forums.swift.org/u/davedelong)\
**Post date:** [August 21, 2022, 9:00pm UTC](https://forums.swift.org/t/which-breaking-changes-would-you-be-willing-to-accept-in-a-major-language-release-feature-wishes/59429/74 "2022-08-21T21:00:38Z")

</div>

Yeah, I've done this before with an associated type to prevent "copying" a conformance limiter from one conformer to another:

```swift
public protocol MyClosedProtocol {
    static var closer: Closer<Self> { get }

    // regular requirements...
}

public struct Closer<T> {
    // publicly visible, but only internally constructible
    // generic type prevents using a Closer<T> on different conformers of "MyClosedProtocol"
    internal init() { }
}

```

[Previous page](https://forums.swift.org/t/which-breaking-changes-would-you-be-willing-to-accept-in-a-major-language-release-feature-wishes/59429.md?page=3)
