Skip to content

Add a changelog for SE-128 #4152

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,33 @@ Note: This is in reverse chronological order, so newer entries are added to the
Swift 3.0
---------

* [SE-128](https://github.com/apple/swift-evolution/blob/master/proposals/0128-unicodescalar-failable-initializer.md)

Some UnicodeScalar initializers (ones that are non-failable) now returns an Optional,
i.e., in case a UnicodeScalar can not be constructed, nil is returned.

```swift
// Old
var string = ""
let codepoint: UInt32 = 55357 // this is invalid
let ucode = UnicodeScalar(codepoint) // Program crashes at this point.
string.append(ucode)
```

After marking the initializer as failable, users can write code like this and the
program will execute fine even if the codepoint isn't valid.

```swift
// New
var string = ""
let codepoint: UInt32 = 55357 // this is invalid
if let ucode = UnicodeScalar(codepoint) {
string.append(ucode)
} else {
// do something else
}
```

* [SE-0095](https://github.com/apple/swift-evolution/blob/master/proposals/0095-any-as-existential.md):
The `protocol<...>` composition construct has been removed. In its
place, an infix type operator `&` has been introduced.
Expand Down