News for hackers. Stuff that matters.
Re:Mental models around Ok-Wrapping by bestouff on Friday April 10, 2020 @01:23PM (#22835133)
I think it all depends on how your function is used in the end:

- if all you're doing is using the value with an added "?" for error handling, like "a = sqrt(b)?;" then Ok-wrapping is perfect, I love it.

- if you need to "match(check_credentials(user, pass)) {Privileges...}" then simply put, don't Ok-wrap and declare your function as usual.

Ok-wrapping sounds really good but shouldn't be used everywhere, like you still use "match" instead of "if let" sometimes. It'd be sad if this idea was aborted just because it's not universal.

There are no comments on this comment yet.