Detail: type naming convention
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 18k
- Forks
- 2.3k
- Avg merge
- 5d 17h
- Merged PRs (30d)
- 10
Description
In the pybind11 detail code, we have 3 different kinds of type information:
- C++ RTTI:
std::type_info - Python's
PyTypeObject - pybind11's extended type information:
detail::type_info
The variable naming scheme for these 3 kinds of type info objects isn't currently very consistent. type, tinfo, type_info, etc. are used interchangeably for all 3 kinds of type info, which can cause confusion (at least it does for me). And as I've recently found in #1014, it can result in some unfortunate expressions like x.type->type (where the second type isn't a Python-style metatype, it's just a different kind of type object).
I'd like to propose a naming convention for these objects (especially when they are members):
std::type_info: variables namedcpptype(already in use, but only partially).PyTypeObject:pytype.detail::type_info: it would be nice to rename the type todetail::extended_type(to avoid confusion withstd::type_info) and name variables likeext_typeoret.
What do you think? Does it make sense or am I just bikeshedding?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the pybind11 detail code and the three type-information forms named in the issue: std::type_info, PyTypeObject, and detail::type_info. Determine whether a naming convention is agreed upon and how broadly it would apply. Done would require a resolved convention and an agreed scope for any renaming.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100