News for hackers. Stuff that matters.
Re:Thoughts on Go vs. Rust vs. Zig by frizlab on Thursday December 04, 2025 @07:13PM (#46155167)
Swift is great for that:

    do {
       let file = try FileManager.create(…)
    } catch {
       logger.error("Failed creating file", metadata: ["error": "\(error)"])
    }
Note the try is not actual CPU exceptions, but mostly syntax sugar.

You can opt-out of the error handling, but it’s frowned upon, and explicit:

    let file = try? FileManager.create(…)
or

    let file = try! FileManager.create(…)
The former returning an optional file if there is an error, and the latter crashing in case of an error.

There are no comments on this comment yet.