SQLite Forum

lemon - optional namespace support
Login
I don't think any sorrow is called for. And the fact that Lemon was written and at times improved to suit the needs or convenience of SQLite project development does not imply that no features making it more generally useful would ever be welcome.

Getting globally visible names into namespaces is quite valuable, especially for components likely to be made part of large projects. The SQLite library upholds this virtue with its ubiquitous SQLITE\_ or sqlite3\_ prefixes on all such names, so it is clear that the project's owner recognizes the virtue.

I looked at your changes, and incorporated them into a private branch. I remember they were quite extensive, although well done and unlikely to create significant problems going forward. However, I wonder if the same benefit could not be achieved by suitably wrapping declarations and definitions into C++ namespace delineation constructs.  The C++ semantics for the meaning of non-scoped names makes this easy to do, non-invasively as I recall. It seems to me that emitting namespace creation/reference wrappers and #include'ing or textually copying the C++-ignorant code, (perhaps with slight changes to make it acceptable to C++ compilers [a]), would present a much lower prospective or actual maintenance burden and attain the same objective for C++ projects.

[a. I refer to some C++ requirements which would have made C a better tool from the beginning without giving it all the C++ features programmers have learned to love and/or dread. ]

Another alteration that seemed possibly more transparent at the working-code level is to simply make the choice between C-style pseudo-namespace names or C++-style genuine-namespace names one which is not visible in the code except by appearance of preprocessor macros.  After all, either MyNamespace:: or MYNAMESPACE\_ can be token-pasted onto the beginning names with quite similar effect.

This is not quite a toss from the peanut gallery as I have performed the suggested namespace construct wrapping on a library which badly needed it because it did not play well with others. The prefix pasting idea is admittedly untested.