-
Notifications
You must be signed in to change notification settings - Fork 9
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
Rename AllocRef
to Allocator
and alloc
to allocate
#76
Comments
When reviewing the PR, I couldn't help but wonder whether people had similar confusions about whether I know this goes beyond the scope of the original proposal, but since we are asking ourselves the question; I'm wondering whether there are more instances that might be ambiguous? |
Hmm, isn't
Do you have something in mind specifically? |
…or,Wodann,m-ou-se Rename `AllocRef` to `Allocator` and `(de)alloc` to `(de)allocate` Calling `Box::alloc_ref` and `Vec::alloc_ref` sounds like allocating a reference. To solve this ambiguity, this renames `AllocRef` to `Allocator` and `alloc` to `allocate`. For a more detailed explaination see rust-lang/wg-allocators#76. closes rust-lang/wg-allocators#76 r? `@KodrAus` `@rustbot` modify labels: +A-allocators +T-libs `@rustbot` ping wg-allocators
I think I'm too close to the subject matter to be confused by it, but I think @Aaron1011's original point was very valid. So maybe they can speak from experience? |
…o develop Rename nightly allocator API fns See rust-lang/wg-allocators#76 [close #55]
Needed since rust-lang/wg-allocators#76 Signed-off-by: Mizuho MORI <[email protected]>
Needed since rust-lang/wg-allocators#76 Signed-off-by: Mizuho MORI <[email protected]> (drop Cargo.lock-changes from commit) Signed-off-by: David Rheinsberg <[email protected]>
With rust-lang/rust#77187 we released
AllocRef
to the wild. It was pointed out, the namesAllocRef
andalloc
are confusing sometimes. The main reason for this, is, that "alloc" is used as a verb and as a noun.in rust-lang/rust#77187 (comment) @Aaron1011 noted, that:
However,
alloc_ref
is the lowercased name of the Trait. @Amanieu also suggested, to rename it toBox::allocator
, but the termallocator
is never used anywhere, so I decided to stick withalloc_ref
for now.I think, it makes sense, to rename
AllocRef
toAllocator
and(de)alloc
to(de)allocate
. The main reason for calling itAllocRef
instead ofAlloc
was, that we wanted to express, thatAllocRef
should be a ZST or a reference to the actual allocator (not a reference to an "alloc" 😉 ). This however is also pointed out in the documentation and we don't expect many people to implement an allocator.A very minor downside is the longer name of
Allocator
andallocate
, but it's way more clear, if you read those terms. The trait will also not be used often directly. In most cases, it will simply be passed toBox
orVec
. So most people neither have to callallocate
ordeallocate
, nor have to importAllocator
into scope. They probably won't even care, how the allocator is implemented (ZST or reference) as long they can simply pass an allocator to those structs.This proposal also includes renaming
Box::alloc_ref
toBox::allocator
.cc @Amanieu @Lokathor @Wodann @CAD97 @scottjmaddox @vertexclique
The text was updated successfully, but these errors were encountered: