[libcxx-commits] [libcxx] [libcxx] renames some template type parameters (PR #76540)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Sun Jan 7 21:46:41 PST 2024


================
@@ -45,6 +45,22 @@ other implementations (e.g. system headers), the test in
 ``libcxx/test/libcxx/system_reserved_names.gen.py`` contains the list of
 reserved names that can't be used.
----------------
ldionne wrote:

I am fine with the change itself, but I question the added value of the documentation. Indeed, this naming scheme works well for e.g. algorithms where the iterators (or predicates, or whatever) don't have any semantics associated to them. However, in other parts of the code, it may convey more information to call the iterator parameter something other than its iterator category. I think it would be better to let people make the right naming decision based on what their code does. However, in cases where we're e.g. writing a new algorithm, folks would end up starting from (or getting inspiration from) code that consistently has the naming we want, so this might end up not being an issue at all.

Basically, I have a slight concern that documenting this naming scheme is going to be too strict, since there are cases where this naming scheme is not what we want. But either way I'm fine with this.

Maybe rewording to

> We **generally** use the following names to refer to various template type parameters:

would alleviate my concern.

https://github.com/llvm/llvm-project/pull/76540


More information about the libcxx-commits mailing list