cplusplus / draft

C++ standards drafts
http://www.open-std.org/jtc1/sc22/wg21/
5.69k stars 749 forks source link

Consider making a new index for macro names #6005

Open AlisdairM opened 1 year ago

AlisdairM commented 1 year ago

Macros are a very special kind of library name, that become more special in C++23.

First, by their nature as macros, they directly rewrite user source rather than participating in name lookup. It would be good to have such names collected in a single place to reference.

Secondly, the library is not the only source of macro names, given the compiler supplies some predefined macros.

Third, as of C++23, the user will not see any of those macros (other than compiler predefines) if they import std; rather than directly include library headers. I think this third point now presses the case for separating macros out of the library/compiler index, and into an index of their own.

Eric41293 commented 1 year ago

I see there are as yet no comments on this issue. Are people for/against this change?

For my part, I am in favor of it.

jensmaurer commented 1 year ago

@tkoeppe, having a separate macro names index sounds reasonable to me. What do you think?

AlisdairM commented 1 year ago

If someone can set up the basic structure for the index, and some macro-indexing LaTeX macros, I volunteer to do the tedious work of marking up all the standard macros for the new index.

JohelEGP commented 1 year ago

We can work with https://github.com/JohelEGP/draft/tree/index_macros. Tell me how you'd like to proceed. I think you should open a PR here once you've reviewed that the index and its macros are OK. And until then, we should work on getting to that point on one of our forks, pushing and opening PRs for them.

jensmaurer commented 1 year ago

We should have buy-in from @tkoeppe before investing any effort into this.

jensmaurer commented 1 year ago

Do we have any exposition-only macros anywhere, @AlisdairM ?

JohelEGP commented 1 year ago

There should be none. Is it about my branch https://github.com/JohelEGP/draft/tree/index_macros? I was thinking of weird ALL CAPS names like STATICALLY-WIDEN when I drafted it, since I associate ALL CAPS with macros.

jensmaurer commented 1 year ago

I think STATICALLY-WIDEN and similar are not really macros, but some special meta-beast that shouldn't appear in a macro index.

In short, it seems we don't need to allow for exposition-only macro names, thus we don't need LaTeX macros dealing with such.

JohelEGP commented 1 year ago

It should be fixed now.

AlisdairM commented 1 year ago

Checking in: if we want this for C++23 I am prepared to do the work of consistently adding the indexing macros on short notice. However, I am assuming it is more likely C++26 than adding a new index at this stage.

Eric41293 commented 1 year ago

@tkoeppe What do you think about this proposal?

AlisdairM commented 2 weeks ago

@JohelEGP Could you create a PR for you branch and link it to this issue? That might raise the visibility for whether we want to do the work to create the content.