News for hackers. Stuff that matters.
Re:Unchecked Java: Say Goodbye to Checked Exceptions Forever by smallerfish on Thursday July 13, 2023 @05:51PM (#36716548)
Or Kotlin's approach:

   fun getUser(userId: UUID): User?
You cannot treat this result value as a `User` in code that calls this; though, once you null check it in your service layer, you can pass it on as `User` in the not-null branch. Null is nothing to be afraid of if the language forces you to declare nullability and deal with it.
Re:Unchecked Java: Say Goodbye to Checked Exceptions Forever by andrekandre on Thursday July 13, 2023 @06:50PM (#36717168)
this is a very common in obj-c too

on the other hand, depending on what your trying to do you might want to provide more context about what happened to the user/programmer

in swift you can change a throwing function to a nullable with `try?` so even if `getUser()` throws, you can keep it simple if thats what is appropriate

  guard let user = try? getUser(id: someUUID) else {
      return "user not found"
  }
as an aside, swift "throws" exceptions but these are just sugar for returning basically an Result<T,E> and compose much better than traditional stack unwinding exceptions imo