Bikeshed: other names for "Kind" in "Allocator" API


#1

RFC PR 1398 proposes a trait for user-defined allocators. As part of the API, it proposes a helper type, named Kind, for describing the layout of a block of memory.

People have pointed out that the word “Kind” may end up confusing things if/when Rust adds support for “higher kinded types” (HKT).

@glaeboerhl has suggested that we rename “Kind” to something else, and proposed “Shape”:

So, what do people think? I have no personal stake in the word “Kind”; I could also imagine other words. So here’s a quick list:

  • “Kind”
  • “Shape”
  • “Layout”
  • “BlockConstraints”

Thoughts?


#2

layout sounds the most descriptive for the intended semantics. Especially if it’ll reside in a suitable path such as std::memory::Layout.


#3

I think Layout sounds fine too. Another idea might be Repr.


#4

For me Repr reminds of Python’s __repr__ and is strongly associated with Rust’s Debug trait. Layout sounds pretty fine for me in this context.


#5

For reference, This is the API we’re bikeshedding.

I would name this Layout. The only misinterpretation I can think of is to assume it’s something to do with where in the address space it is, but the (size, alignment) members make it pretty clear what it’s for.

I’d be fine with Shape too, but it feels a little unnatural to me: It’s not a word I’d use when talking about allocators.