Skip to content

Commit 224ab4b

Browse files
ericalattner
authored andcommitted
Changelog edits, up to but not including SE-0099 (#4895)
1 parent ea5aaa6 commit 224ab4b

File tree

1 file changed

+19
-38
lines changed

1 file changed

+19
-38
lines changed

CHANGELOG.md

Lines changed: 19 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -198,22 +198,15 @@ using the `.dynamicType` member to retrieve the type of an expression should mig
198198

199199
* [SE-0025][]:
200200

201-
A declaration marked as `private` can now only be accessed within the lexical
202-
scope it is declared in (essentially the enclosing curly braces `{}`).
203-
A `private` declaration at the top level of a file can be accessed anywhere
204-
in that file, as in Swift 2. The access level formerly known as `private` is
205-
now called `fileprivate`.
201+
The access level formerly known as `private` is now called `fileprivate`. A Swift 3 declaration marked `private` can no longer be accessed outside its lexical scope (essentially its enclosing curly braces `{}`). A `private` declaration at the top level of a file can be accessed anywhere within the same file, as it could in Swift 2.
206202

207203
* [SE-0131][]:
208204

209-
The standard library provides a new type `AnyHashable` for use in heterogeneous
210-
hashed collections. Untyped `NSDictionary` and `NSSet` APIs from Objective-C
211-
now import as `[AnyHashable: Any]` and `Set<AnyHashable>`.
205+
The standard library introduces the `AnyHashable` type for use in hashed heterogeneous collections. Untyped `NSDictionary` and `NSSet` Objective-C APIs now import as `[AnyHashable: Any]` and `Set<AnyHashable>`.
212206

213207
* [SE-0102][]:
214208

215-
The `@noreturn` attribute on function declarations and function types has been
216-
removed, in favor of an empty `Never` type:
209+
Swift removes the `@noreturn` attribute on function declarations and replaces the attribute with an empty `Never` type:
217210

218211
```swift
219212
@noreturn func fatalError(msg: String) { ... } // old
@@ -225,15 +218,11 @@ using the `.dynamicType` member to retrieve the type of an expression should mig
225218

226219
* [SE-0116][]:
227220

228-
Objective-C APIs using `id` now import into Swift as `Any` instead of as `AnyObject`.
229-
Similarly, APIs using untyped `NSArray` and `NSDictionary` import as `[Any]` and
230-
`[AnyHashable: Any]`, respectively.
221+
Swift now imports Objective-C `id` APIs as `Any`. In Swift 2, `id` imported as `AnyObject`. Swift also imports untyped `NSArray` and `NSDictionary` as `[Any]` and `[AnyHashable: Any]`, respectively.
231222

232223
* [SE-0072][]:
233224

234-
Bridging conversions are no longer implicit. The conversion from a Swift value type to
235-
its corresponding object can be forced with `as`, e.g. `string as NSString`. Any Swift
236-
value can also be converted to its boxed `id` representation with `as AnyObject`.
225+
Swift eliminates implicit bridging conversions. Use `as` to force the conversion from a Swift value type to its corresponding object. For example, use `string as NSString`. Use `as AnyObject` to convert a Swift value to its boxed `id` representation.
237226

238227
* Collection subtype conversions and dynamic casts now work with protocol types:
239228

@@ -246,40 +235,36 @@ using the `.dynamicType` member to retrieve the type of an expression should mig
246235

247236
* [SR-2131](https://bugs.swift.org/browse/SR-2131):
248237

249-
The `hasPrefix` and `hasSuffix` functions now consider the empty string to be a
250-
prefix and suffix of all strings.
238+
The `hasPrefix` and `hasSuffix` functions now consider the empty string to be a prefix and suffix of all strings.
251239

252240
* [SE-0128][]:
253241

254-
Some UnicodeScalar initializers (ones that are non-failable) now return an Optional,
255-
i.e., in case a UnicodeScalar can not be constructed, nil is returned.
242+
Some non-failable UnicodeScalar initializers now return an Optional. When a UnicodeScalar cannot be constructed, these initializers return nil.
256243

257244
```swift
258245
// Old
259246
var string = ""
260-
let codepoint: UInt32 = 55357 // this is invalid
261-
let ucode = UnicodeScalar(codepoint) // Program crashes at this point.
247+
let codepoint: UInt32 = 55357 // Invalid
248+
let ucode = UnicodeScalar(codepoint) // Program crashes here.
262249
string.append(ucode)
263250
```
264251

265-
After marking the initializer as failable, users can write code like this
266-
and the program will execute fine even if the codepoint isn't valid.
252+
The updated initializers allow users to write code that safely works around invalid codepoints, like this example:
267253

268254
```swift
269255
// New
270256
var string = ""
271-
let codepoint: UInt32 = 55357 // this is invalid
257+
let codepoint: UInt32 = 55357 // Invalid
272258
if let ucode = UnicodeScalar(codepoint) {
273-
string.append(ucode)
259+
string.append(ucode)
274260
} else {
275-
// do something else
261+
// do something else
276262
}
277263
```
278264

279265
* [SE-0095][]:
280266

281-
The `protocol<...>` composition construct has been removed. In its
282-
place, an infix type operator `&` has been introduced.
267+
Swift removes the `protocol<...>` composition construct and introduces an infix type operator `&` in its place.
283268

284269
```swift
285270
let a: Foo & Bar
@@ -289,13 +274,11 @@ using the `.dynamicType` member to retrieve the type of an expression should mig
289274
typealias G = GenericStruct<Foo & Bar>
290275
```
291276

292-
The empty protocol composition, the `Any` type, was previously
293-
defined as being `protocol<>`. This has been removed from the
294-
standard library and `Any` is now a keyword with the same behaviour.
277+
Swift previously defined the empty protocol composition (the `Any` type) as `protocol<>`. This definition has been removed from the standard library. The `Any` keyword behavior remains unchanged.
295278

296279
* [SE-0091][]:
297280

298-
Operators can now be defined within types or extensions thereof. For example:
281+
Swift permits you to define operators within types or their extensions. For example:
299282

300283
```swift
301284
struct Foo: Equatable {
@@ -307,18 +290,16 @@ using the `.dynamicType` member to retrieve the type of an expression should mig
307290
}
308291
```
309292

310-
Such operators must be declared as `static` (or, within a class, `class
311-
final`), and have the same signature as their global counterparts. As part of
312-
this change, operator requirements declared in protocols must also be
313-
explicitly declared `static`:
293+
You must declare these operators as `static` (or, within a class, `class
294+
final`) and they must use the same signature as their global counterparts. As part of this change, protocol-declared operator requirements must be declared `static` explicitly:
314295

315296
```swift
316297
protocol Equatable {
317298
static func ==(lhs: Self, rhs: Self) -> Bool
318299
}
319300
```
320301

321-
Note that the type checker performance optimization described by [SE-0091][]
302+
Note: The type checker performance optimization described by [SE-0091][]
322303
is not yet implemented.
323304

324305
* [SE-0099][]:

0 commit comments

Comments
 (0)