Skip to content

Proposal: Result Codable conformance and async init #2741

New issue

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

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

Already on GitHub? # to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ktoso
Copy link
Contributor

@ktoso ktoso commented Mar 17, 2025

This is a proposal to add:

  • Codable conformance to Result when Failure and Success are Codable
  • async catching: init

The combination of those allows "catching" an async computation and have the result be Codable if the error also was.

ktoso and others added 2 commits March 17, 2025 21:00
Co-authored-by: YOCKOW <YOCKOW@users.noreply.github.com>
Co-authored-by: YOCKOW <YOCKOW@users.noreply.github.com>
@ktoso
Copy link
Contributor Author

ktoso commented Mar 17, 2025

Thanks for the fixups :)

@rjmccall rjmccall added the LSG Contains topics under the domain of the Language Steering Group label Mar 17, 2025
///
/// - Parameter body: A potentially throwing asynchronous closure to evaluate.
@_alwaysEmitIntoClient
public init(catching body: () async throws(Failure) -> Success) async {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes please!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
LSG Contains topics under the domain of the Language Steering Group
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants