• 0 Posts
  • 331 Comments
Joined 1 year ago
cake
Cake day: July 15th, 2023

help-circle











  • I think a better solution would be to add a method called something like ulock that does a combined lock and unwrap.

    My concern with lock+unwrap is only partly because of convenience; I also didn’t like it because I think it’s a bad idea to get people used to casually calling unwrap, because it tends to hide inadequate error handing.

    Now that I think about it, I don’t like how unwrap can signal either “I know this can’t fail”, “the possible error states are too rare to care about” or “I can’t be bothered with real error handing right now”. In one or two of those cases you want to leave it in my production code, and in the last you want to audit all instances and replace them with proper error handing. Using the same function for all three cases makes that difficult.