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 upunwrap/get/get_ref/take etc. conventions #13159
Comments
brson
added
A-libs
labels
Mar 26, 2014
nikomatsakis
referenced this issue
Mar 28, 2014
Closed
option: rename unwrap to get or remove get_ref in favour of as_ref().unwrap() #9784
This comment has been minimized.
This comment has been minimized.
|
Off-line with @brson and @alexcrichton suggested that there is some sort of conventions, though they are not universally followed. These conventions can be roughly broken down based on what sort of
One name that I did not list is
In all cases, these operations can be fallible or infallible depending on the type, which is perhaps unfortunate. I'd like to remedy this if possible but I'm not sure if it is. |
This comment has been minimized.
This comment has been minimized.
|
how about .v() returns a (cloned) value, and .r() returns a ref? (If |
This comment has been minimized.
This comment has been minimized.
|
It'd be nice if we could separate the fallable and infallable methods naming-wise somehow. I always double-take a bit when seeing an |
This comment has been minimized.
This comment has been minimized.
|
I was hoping to incorporate the word Some ideas:
One a related note, I think we should at some point remove In general, the best state is one where the only fallible APIs are Option/Result's |
This comment has been minimized.
This comment has been minimized.
|
An infallible one should probably just be a |
This comment has been minimized.
This comment has been minimized.
|
I don't think |
This comment has been minimized.
This comment has been minimized.
|
On Sat, Mar 29, 2014 at 12:18:36AM -0700, Steven Fackler wrote:
I tend to agree. It's likely we can overcome the by-value restriction |
This comment has been minimized.
This comment has been minimized.
|
marking P-backcompat-libs, 1.0 |
pnkfelix
added
P-backcompat-libs
and removed
I-nominated
labels
Apr 3, 2014
pnkfelix
added this to the 1.0 milestone
Apr 3, 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. |
brson commentedMar 26, 2014
I'm sure there are other issues about this, which naturally I can't find. We need to make sure the conventions for these accessors are consistent for 1.0. Nominating.