hsutter / cppfront

A personal experimental C++ Syntax 2 -> Syntax 1 compiler
Other
5.46k stars 238 forks source link

[SUGGESTION] Maybe reserve additional keywords (that aren't needed yet) in case cppfront wants them in the future. #908

Closed HenryHeffan closed 9 months ago

HenryHeffan commented 9 months ago

In your talk at CppCon, you pointed out that since you are designing the a new syntax without any existing code, you are free to reserve keywords in c++ syntax 2 that currently are not reserved in c++ syntax 1 (without breaking old code).

Maybe it would be a good idea for cppfront to grab additional keywords that aren't needed yet but that seem likely to be useful int the future. For example, even if it isnt used yet, "when" and "to" and "with" could be reserved words (if they aren't yet). Maybe one could look at other languages for inspiration and grab some of the same keywords that are used there? If the keywords turn out not to be useful, they could always be released back to users later. But, if they turn out to be useful, then cppfront would be able to continue to have the best name for things in the future.

This is not a fully formed thought and I dont have a full list of additional keywords to grab, but I was thinking about this while watching your talk and thought this might be an idea worth considering.

JohelEGP commented 9 months ago

I suspect this might not be necessary given this passage from https://github.com/hsutter/cppfront/discussions/642#discussioncomment-6994057:

  • Cpp2 keywords are contextual, they are not globally reserved words. For example, std::is_integral<T>::type works fine even though it uses the word type; for example, my_type_alias: type == std::is_integral<int>::type; works.
HenryHeffan commented 9 months ago

Oops! That makes sense. I'm going to close this issue.