-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Going back to get returning a Result #83
Comments
I've been pretty vocal up to this point about this issue along with @almetica, because I think both of our applications have pretty serious consequences if they hit panics (that could have been avoided like using I lean towards moving towards Any other function that can panic is one that is usually called at the beginning or the end of the life of the application, or it is something unrecoverable like not being able to borrow a storage. Therefore it is not as big of a deal to me to panic because of a borrowing issue, since there wasn't much I could do anyway. |
I've been staying out of the convo mostly because it's been a crazy week for me personally, haven't even had time to look at the changes in 0.4 yet - but also because there's simply good arguments on both sides... At the end of the day though, I'm going to give it a 👍 because the tradeoff seems to be verbosity for safety, and I think that's generally more in line with what people expect from Rust. Having |
So, uhhh, I didn't read this carefully or play with it enough. Changed my vote to 👎 since having However, I don't think my vote should swing anything - obviously everyone else has thought more carefully about this than me 😅 ... so please count my vote as like half a vote ;) Just changing it because I felt not doing so would be disingenuous since I have changed my stance, fwiw. |
In 0.4 I made
get
panic if a component isn't found and addedtry_get
to return aResult
.Both 0.3 and 0.4
Get
traits have their pros and cons. It's also possible to personalize the library locally so the question is whether 0.3 or 0.4 way should be the default.get
returningResult
has a big advantage, it's what the Rust ecosystem does and is less surprising for all users (especially new ones).get
panicking is useful for prototyping when you don't want to think about errors and it fits shipyard'stry_*
alternatives.Previous discussions on the subject:
zulip
github
#80 will be implemented regardless of this issue.
👍 to go back to
get
returning aResult
, no moretry_get
👎 to keep
get
andtry_get
the way they areThe text was updated successfully, but these errors were encountered: