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

help-circle










  • Just look at all the people getting frustrated at being told “you should probably do it a different way.” They really don’t understand that just because they’re asking the question, it’s not all about them.

    I don’t agree. I remember having a problem (something with PDF and JS if I remember correctly) and I had some restrictions (no I could not do anything about those restrictions). Someone on SO had asked my question with somewhat the same restrictions, which boiled downed to no being able to utilize the most common solution. The first answer on SO was to use the solution that specifically could not be used.

    I can see your point and I actually somewhat agree but when the answers are “do X” to the question “how do I do this when I cannot do X?”, the audience should be the minority going there because they have a niece problem, not the majority that are lead there by search engines. And all the “do X” answers should be removed, or moved somewhere they are relevant.










  • 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.