Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upoption: rename unwrap to get or remove get_ref in favour of as_ref().unwrap() #9784
Comments
This comment has been minimized.
This comment has been minimized.
|
I was under the impression that we were going to rename I also believe that the reason for leaving these two methods instead of making them composable was because they're likely very common patterns. |
thestinger
referenced this issue
Oct 12, 2013
Closed
RFC: Boxes vs Containers - Naming schemes for element access #7887
This comment has been minimized.
This comment has been minimized.
|
Nominated for library backwards compatibility tag. |
This comment has been minimized.
This comment has been minimized.
|
+1 for |
This comment has been minimized.
This comment has been minimized.
|
If we rename, other types (like arcs) should be consistent. 1.0, backwards-compat |
This comment has been minimized.
This comment has been minimized.
|
This is fine, but please let's stop changing this. This needs to be the last change and then this method is frozen and changing it is off the table. |
This comment has been minimized.
This comment has been minimized.
|
I vote for |
This comment has been minimized.
This comment has been minimized.
|
1+ for |
This comment has been minimized.
This comment has been minimized.
|
One thing that's not clear to me: among Haskellers, using |
This comment has been minimized.
This comment has been minimized.
|
It's better to have a reusable evil method with a concise name than the current situation of many functions preferring to fail than return an |
This comment has been minimized.
This comment has been minimized.
|
It sounds like it might be worth going through the stdlib and converting I agree with @glehel that Rust seems to be far too free with using As a point against this in Rust, we don't have the functors/applicatives/ |
This comment has been minimized.
This comment has been minimized.
|
Also, we very often use use For example, something like
Mutable options also necessitate a lot of wrapping and unwrapping of values, as those cases are basically one-element containers. |
This comment has been minimized.
This comment has been minimized.
|
cc #13159 |
thestinger
closed this
Jun 17, 2014
thestinger
reopened this
Jun 17, 2014
thestinger
changed the title
(RFC) option: rename unwrap to get
(RFC) option: rename unwrap to get or remove get_ref in favour of as_ref().unwrap()
Jun 17, 2014
thestinger
changed the title
(RFC) option: rename unwrap to get or remove get_ref in favour of as_ref().unwrap()
option: rename unwrap to get or remove get_ref in favour of as_ref().unwrap()
Jun 17, 2014
thestinger
removed
the
B-RFC
label
Jun 17, 2014
brson
assigned
aturon
Aug 1, 2014
This comment has been minimized.
This comment has been minimized.
|
The guidelines now have a convention for these names. I will be rolling them out in a patch soon. |
This comment has been minimized.
This comment has been minimized.
|
The PR for Option/Result stabilization resolved this issue by deprecating |
thestinger commentedOct 9, 2013
There are already nearly identical methods named
get_ref()andget_mut_ref()andstd::hashmapnames the equivalent methodget. This method doesn't always move, it's just a normal by-value method, so it should follow the same convention as other get-or-fail methods. If it used the shorter naming, replacingget_mut_ref()withas_mut().get()would only add a character.