On Tue, Nov 13, 2018 at 9:51 AM Joachim Wuttke <j.wut...@fz-juelich.de> wrote:
> My understanding was that prevalent usage in modern CMake > is all lowercase for function names, all uppercase for > macro names. In this sense, I submitted a number of merge > requests where function and macro names are normalized, and > in > https://gitlab.kitware.com/cmake/cmake/merge_requests/2607 > I suggest an explicit recommendation in the macro and > function doc pages. > > Now I am learning from Craig Scott that the more recent > convention is actually all lowercase for macros as well > as for functions. > To be clear, my understanding is that in the past (many years ago), uppercase tended to be common, but I don't see that used much these days for functions, macros or built-in commands. The general sentiment seems to be that uppercase tends to be a bit "shouty" now. I'm suggesting that if we're going to bring some consistency to the docs, I propose that we just go with lowercase everywhere (functions, macros, built-in commands and examples). <nit-filter ON> Regarding the finer points of macros versus functions versus built-in commands and establishing a convention, it's actually a bit difficult to draw a hard line in behaviour across all three. Consider commands like find_package() and project(). These are built-in commands, but they behave like a macros in that they add variables to the calling scope (yes, functions can do that too, but the primary reason to use macros is to inject variables into the calling scope). Most built-in commands act more like functions and do not modify the calling scope. Trying to decide whether built-in commands act like macros and which do not and making them upper or lowercase based on that is unlikely to be a distinction that most users would make, so a mix of upper and lowercase for built-in commands would be unexpected. A consequence of this is that having macros and functions with differing case conventions would seem to create a potential inconsistency with whatever convention is used for built-in commands. The only way to really have consistency here would seem to be just use the one case convention, for which lowercase seems to be the logical and increasingly prevalent choice. <nit-filter OFF> > > Thus two requests for comments: > > - Shall the reference manual give a clear recommendation > on preferred case, to stear the community away from the > inherited anarchy? > The docs can be consistent throughout, but matters of style are ultimately up to individual projects and their own coding conventions. Over time, making the CMake docs present a consistent style will likely encourage projects that don't have a convention of their own to adopt that style out of familiarity. -- Craig Scott Melbourne, Australia https://crascit.com New book released: Professional CMake: A Practical Guide <https://crascit.com/professional-cmake/>
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: https://cmake.org/mailman/listinfo/cmake-developers