You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I propose to use the ! character to represent unwrap() on Result and Option types, similar to ? being used for Err and None propagation.
So this:
fnfoo(bar:Option<Bar>) -> Bar{
bar.unwrap()}
becomes this:
fnfoo(bar:Option<Bar>) -> Bar{
bar!
}
Please do not respond with some flavor of "but syntax proposals are always bad" or "this is not strictly necessary." That is categorically unhelpful. Keep your judgements to the proposed syntax itself.
One issue with this could be if the Option or Result is of a function type, and unwrapping it to call it makes it resemble a macro.
Any other thoughts?
The text was updated successfully, but these errors were encountered:
I propose to use the ! character to represent unwrap() on Result and Option types, similar to ? being used for Err and None propagation.
So this:
becomes this:
Please do not respond with some flavor of "but syntax proposals are always bad" or "this is not strictly necessary." That is categorically unhelpful. Keep your judgements to the proposed syntax itself.
One issue with this could be if the Option or Result is of a function type, and unwrapping it to call it makes it resemble a macro.
Any other thoughts?
The text was updated successfully, but these errors were encountered: