|
| 1 | +--- |
| 2 | +layout: post |
| 3 | +title: ! 'Issue #154' |
| 4 | +author: btb |
| 5 | +sponsor: |
| 6 | + link: https://nativeconnect.app |
| 7 | + heading: NativeConnect is a beautiful desktop client for App Store Connect |
| 8 | + body: 'Hey 👋 We are building a Mac app which is 💯 Swift and AppKit<br /> |
| 9 | + 1. View downloads and sales on the same page<br /> |
| 10 | + 2. Edit metadata for multiple languages in batches<br /> |
| 11 | + 3. Manage customer reviews and developer responses<br /> |
| 12 | + 4. All fetched data is stored locally and never leaves your Mac<br /> |
| 13 | + 5. Customers love it ❤️' |
| 14 | + displaylink: nativeconnect.app |
| 15 | +--- |
| 16 | + |
| 17 | +I've been keeping myself busy the last two weeks with exciting things going on |
| 18 | +at work, and visiting other offices. We've also been hard at work on |
| 19 | +preparations for the SwiftAveiro conference, which I'm co-organizing this year. |
| 20 | + |
| 21 | +All in all, cool stuff going on! |
| 22 | + |
| 23 | +That said, here's what kept some other people busy these past two weeks... |
| 24 | + |
| 25 | +<!--excerpt--> |
| 26 | + |
| 27 | +{% include sponsor.html %} |
| 28 | + |
| 29 | +### Starter tasks |
| 30 | + |
| 31 | +- [SR-12247](https://bugs.swift.org/browse/SR-12247) [Compiler] Replace the |
| 32 | +type alias `ModuleDecl::ImportedModule` with a dedicated struct |
| 33 | +- [SR-12248](https://bugs.swift.org/browse/SR-12248) [TypeChecker] `<unknown>` |
| 34 | +diagnostic location regarding `Codable` derived conformances |
| 35 | + |
| 36 | +### News and community |
| 37 | + |
| 38 | +[Dmitri Gribenko](https://github.com/gribozavr) shared [the Swift and C++ interoperability manifesto](https://github.com/apple/swift/blob/master/docs/CppInteroperabilityManifesto.md), summarized |
| 39 | +possible design options of this goal. |
| 40 | + |
| 41 | +[Nate Cook](https://twitter.com/nnnnnnnn) wrote [a blog post](https://swift.org/blog/preview-package/) |
| 42 | +on the Swift.org blog, on the newly released Standard Library Preview Package. |
| 43 | + |
| 44 | +[Slava Pestov](https://twitter.com/slava_pestov) wrote [a blog post](https://swift.org/blog/library-evolution/) |
| 45 | +on the Swift.org blog, on Swift's library evolution capabilities. |
| 46 | + |
| 47 | +[Will Lisac](https://twitter.com/wlisac) open sourced [a project](https://github.com/wlisac/swift-log-slack) |
| 48 | +on top of `swift-log` that allows you to send logging messages to Slack. |
| 49 | + |
| 50 | +### Commits and pull requests |
| 51 | + |
| 52 | +[Max Desiatov](https://github.com/MaxDesiatov) merged [a pull request](https://github.com/apple/swift/pull/29530), |
| 53 | +upstreaming almost a quarter of the huge patch from the [SwiftWasm](https://github.com/swiftwasm) |
| 54 | +team, which brings us closer to enabling WebAssembly/[WASI](https://wasi.dev/) |
| 55 | +target in the compiler and running Swift code in browsers. |
| 56 | + |
| 57 | +[David Smith](https://twitter.com/Catfish_Man) merged [a pull request](https://github.com/apple/swift/pull/24303) |
| 58 | +that adds the new uninitialized buffer String initializer privately, improving |
| 59 | +its performance. |
| 60 | + |
| 61 | +[Pavel Yaskevich](https://github.com/xedin) merged [a pull request](https://github.com/apple/swift/pull/29906) |
| 62 | +mostly finishing the diagnostics engine rewrite, and the people working on the |
| 63 | +expression checker are now ready to rip out the old implementation completely! |
| 64 | + |
| 65 | +[Doug Gregor](https://twitter.com/dgregor79) merged [a pull request](https://github.com/apple/swift/pull/30045) |
| 66 | +to add support for patterns in "if" statements for function builders, so one |
| 67 | +can use `if-let`, `if-case`, etcetera. |
| 68 | + |
| 69 | +### Accepted proposals |
| 70 | + |
| 71 | +[SE-0277](https://github.com/apple/swift-evolution/blob/master/proposals/0277-float16.md): *Float16* was [accepted](https://forums.swift.org/t/accepted-se-0277-float16/34121). |
| 72 | + |
| 73 | +> The review has concluded and the proposal is accepted. |
| 74 | +
|
| 75 | +[SE-0274](https://github.com/apple/swift-evolution/blob/master/proposals/0274-magic-file.md): *Concise magic file names* was [accepted](https://forums.swift.org/t/accepted-se-0274-concise-magic-file-names/34115). |
| 76 | + |
| 77 | +> The second review has concluded and the proposal has been accepted. |
| 78 | +> |
| 79 | +> - `#file` will be altered to only report the module and filename |
| 80 | +> - `#filePath` will be introduced to replicate the previous full file+path for |
| 81 | +use cases that relied on the path previously. |
| 82 | +- While the team acknowledges that this does require some existing workflows to |
| 83 | +adapt to the new scheme, the binary size and privacy concerns over implicitly |
| 84 | +embedding the full path were significant enough to warrant this change. |
| 85 | +> |
| 86 | +> During the second review, the format of the new `#file` value was discussed |
| 87 | +and will be locked down in a way that users can rely on. The core team expects |
| 88 | +future tooling to be created that will allow for easy processing of this value. |
| 89 | + |
| 90 | +### Proposals in review |
| 91 | + |
| 92 | +[SE-0278](https://github.com/apple/swift-evolution/blob/master/proposals/0278-package-manager-localized-resources.md): *Package Manager Localized Resources* is [under review](https://forums.swift.org/t/se-0278-package-manager-localized-resources/33950). |
| 93 | + |
| 94 | +> This proposal builds on top of the [Package Manager Resources](0271-package-manager-resources.md) proposal to allow defining localized versions of resources in the SwiftPM manifest and have them automatically accessible at runtime using the same APIs. |
| 95 | +
|
| 96 | +## Motivation |
| 97 | + |
| 98 | +> The recently accepted [Package Manager Resources](https://github.com/apple/swift-evolution/blob/master/proposals/0271-package-manager-resources.md) |
| 99 | +proposal allows SwiftPM users to define resources (images, data file, etc...) |
| 100 | +in their manifests and have them packaged inside a bundle to be accessible at |
| 101 | +runtime using the Foundation `Bundle` APIs. Bundles support storing different |
| 102 | +versions of resources for different localizations and can retrieve the version |
| 103 | +which makes most sense depending on the runtime environment, but SwiftPM |
| 104 | +currently offers no way to define those localized variants. |
| 105 | +> |
| 106 | +> While it is technically possible to benefit from localization today by |
| 107 | +setting up a resource directory structure that the `Bundle` API expects and |
| 108 | +specifying it with a `.copy` rule in the manifest (to have SwiftPM retain the |
| 109 | +structure), this comes at a cost: it bypasses any platform-custom processing |
| 110 | +that comes with `.process`, and doesn't allow SwiftPM to provide diagnostics |
| 111 | +when localized resources are mis-configured. |
| 112 | +> |
| 113 | +> Without a way to define localized resources, package authors are missing out |
| 114 | +on powerful Foundation APIs to have their applications, libraries and tools |
| 115 | +adapt to different regions and languages. |
| 116 | + |
| 117 | +### Swift Forums |
| 118 | + |
| 119 | +[Saleem Abdulrasool](https://twitter.com/compnerd) shared [that Foundation's full test suite passes on Windows](https://forums.swift.org/t/swift-soars-ever-higher/34036)! |
| 120 | + |
| 121 | +> I am extremely excited to announce that as of today we have the full test |
| 122 | +suite for Foundation passing on Windows as well! Although there are a few tests |
| 123 | +which are testing Unix specific behaviors which do not port, this is largely on |
| 124 | +parity with the Linux test suite. There are a total of 1706 tests on Windows |
| 125 | +that are running with Linux currently having 1714. |
| 126 | + |
| 127 | +[Yuta Saito](https://twitter.com/kateinoigakukun) shared [an update](https://forums.swift.org/t/wasm-support/16087/14) |
| 128 | +on the progress of the WebAssembly compiler target. |
| 129 | + |
| 130 | +> Now that the swiftwasm project succeeds to pass quite a few tests in its test |
| 131 | +suite, we are planning to send some patches to upstream. |
| 132 | +> |
| 133 | +> Before sending them, I want to confirm and clarify the direction of |
| 134 | +supporting WebAssembly. |
| 135 | + |
| 136 | +[Sergej Jaskiewicz](https://twitter.com/broadway_lamb) shared [an idea](https://forums.swift.org/t/support-building-rust-targets-in-spm/33898) |
| 137 | +to add support for Rust targets to the Swift Package Manager. |
| 138 | + |
| 139 | +> I've just come up with this crazy idea: what if we allow SPM to build Rust |
| 140 | +targets? |
| 141 | +> |
| 142 | +>For now I have the following in mind: |
| 143 | +> |
| 144 | +> - Obviously, for building Rust targets the rust toolchain has to be installed. |
| 145 | +> - We don't use Cargo for building Rust targets, but rather invoke `rustc` |
| 146 | +directly. We could allow Swift packages to depend on Cargo packages in the |
| 147 | +future, but that seems nontrivial. |
| 148 | +> - Rust targets can only depend on other Rust targets. Swift or Clang targets |
| 149 | +cannot depend on Rust targets. Why? Because it would require a lot of work. |
| 150 | +Later we could allow Rust targets to have the "include" directory just like |
| 151 | +Clang targets, which would contain C headers for that target so that the Rust |
| 152 | +target could be used from Swift using those headers (just like C++ targets |
| 153 | +today can be used from Swift via C headers). |
| 154 | + |
| 155 | +[Gwynne Raskind](https://twitter.com/_AngeloidBeta) pitched [a proposal](https://forums.swift.org/t/property-wrapper-requirements-in-protocols/33953) |
| 156 | +to add property wrapper requirements in protocols. |
| 157 | + |
| 158 | +> It is sometimes desirable for a protocol to require that a conforming type |
| 159 | +use a property wrapper in the declaration of a required property. This allows |
| 160 | +consumers of the protocol to access the wrapper's projected value and |
| 161 | +properties, not just the wrapped value. |
| 162 | +> |
| 163 | +> We propose allowing a subset of property wrapper syntax to appear in protocol |
| 164 | +declarations. |
| 165 | + |
| 166 | +[Joe Groff](https://twitter.com/jckarter) shared [an update](https://forums.swift.org/t/update-on-se-0110-and-se-0155/33948) |
| 167 | +on SE-0110 and SE-0155. |
| 168 | + |
| 169 | +> In the Swift 3 era, several source-breaking proposals had been accepted with |
| 170 | +the goal of cleaning up and regularizing parts of the language. However, many |
| 171 | +of them have been stuck in the "Accepted" but not "Implemented" stage for |
| 172 | +quite a while now, because we never quite got , and the barrier for breaking |
| 173 | +source compatibility is much higher now than it was in the heady early days of |
| 174 | +Swift evolution. As such, the Core Team has started going through some of these |
| 175 | +proposals to record their current implementation status and subset out |
| 176 | +remaining unimplemented source-breaking changes. To start off, I recently |
| 177 | +reviewed the implementation status of two proposals: |
| 178 | +> |
| 179 | +> - [SE-0110](https://github.com/apple/swift-evolution/blob/master/proposals/0110-distingish-single-tuple-arg.md), Distinguish between single-tuple and multiple-argument function types |
| 180 | +> - [SE-0155](https://github.com/apple/swift-evolution/blob/master/proposals/0155-normalize-enum-case-representation.md), Normalize Enum Case Representation |
| 181 | +> |
| 182 | +> **SE-0110** |
| 183 | +> |
| 184 | +> This proposal changed the behavior of functions with multiple arguments from |
| 185 | +being considered to have one formal argument of tuple type to instead be |
| 186 | +treated as formally having multiple arguments. This change has been fully |
| 187 | +implemented as of Swift 5.2; however, the [original proposal as reviewed](https://github.com/apple/swift-evolution/blob/9e44932452e1daead98f2bc2e58711eb489e9751/proposals/0110-distingish-single-tuple-arg.md) |
| 188 | +did not include the special-case conversion from `(T, U, ...) -> V` to |
| 189 | +`((T, U, ...)) -> V` for function arguments. In response to community feedback, |
| 190 | +this conversion was added as part of the Core Team's acceptance of the proposal. |
| 191 | +> If and when that happens, it will be done as a fresh pitch and proposal. |
| 192 | +> |
| 193 | +> **SE-0155** |
| 194 | +> |
| 195 | +> Although unfortunate, the Core Team does not consider it worth breaking |
| 196 | +source compatibility to change this behavior. Therefore, the pattern matching |
| 197 | +part of the proposal has been downscoped to allow for disambiguation when |
| 198 | +multiple cases share a base name, without changing the behavior for existing |
| 199 | +enums supported today. |
| 200 | + |
| 201 | +[Reda Lemeden](https://twitter.com/kaishin) asked [a question](https://forums.swift.org/t/swift-package-naming-conventions/33931) |
| 202 | +about Swift Package naming conventions. |
| 203 | + |
| 204 | +> - Some packages use dash-case (aka kebab-case). Notable examples: |
| 205 | +`swift-driver`, `swift-numerics`, `swift-log`, `swift-crypto`, and `swift-nio`. |
| 206 | +Other that fall into this group are SSWG packages and the new standard library |
| 207 | +preview packages. |
| 208 | +> - Some packages use CamelCase. Notable examples: `SwiftPM` itself, |
| 209 | +`SourceKitLSP`, and `SwiftSyntax`. Almost all iOS/macOS packages follow this |
| 210 | +convention. |
| 211 | +> |
| 212 | +> I understand if this detail is considered trivial or irrelevant, especially |
| 213 | +since package names play a much lesser role compared to other package managers |
| 214 | +such as npm. It is also worth noting that this situation is not unique to SPM |
| 215 | +and can be found in other ecosystems, such as Rust, where `snake_cased` and |
| 216 | +`dash-cased` crate names are both widely used (although the latter is gaining |
| 217 | +more momentum). |
| 218 | +> |
| 219 | +> At the same time, I think that with the eventual introduction of a package |
| 220 | +registry (GitHub's or otherwise), these naming inconsistencies are going to |
| 221 | +surface to the end user much more than they do today. |
| 222 | +> |
| 223 | +> Is the absence of SPM package naming guidelines by design? If so, can someone |
| 224 | +shed some light on this? |
| 225 | +> If it is not, would it make sense to pursue converging towards one |
| 226 | +convention? Could it happen organically or should it be enforced on the |
| 227 | +manifest level? |
| 228 | + |
| 229 | +### Finally |
| 230 | + |
| 231 | +[~~`// FIXME`~~, oops I mean `// FORGIVE ME`](https://twitter.com/danielpunkass/status/1232650866949316608) |
0 commit comments