• 1 Post
  • 53 Comments
Joined 1 year ago
cake
Cake day: June 26th, 2023

help-circle















  • If function does not return Result and returns just value directly, you (as a function caller) are guaranteed to always get a value, you can rely on there not being a failure that the function didn’t handle internally.

    The difference being where you handle the error?

    It sounds to me like Java works in kinda the same way. You either use throws Exception and require the caller to handle the exception when it occurs, or you handle it yourself and return whatever makes sense when that happens (or whatever you want to do before you do a return). The main difference being how the error is delivered.

    Java has class similar to Result called Optional.