Closed rbrunner7 closed 2 years ago
My current personal opinion: I would be ok with both styles. I lean a bit towards snake case however, I doubt a bit that the advantages of CamelCase names for types merit the exception that they bring, but readily accept that other people see that differently.
My red line however would be that not even the few people working on the Seraphis wallet would use the same naming style for types.
I prefer camel case for types in order to disambiguate from methods, third-party core library types (e.g. std
and boost
mainly), and built-in and simple types (I consider all the jamtis types in jamtis_support_types.h
as simple types - i.e. single data field types with only basic member functions).
Also, reading code is a bit nicer when everything doesn't blend together.
From a coding perspective, I vote to go with Camel case. It is easy to mistake an underscore for just a space, especially when you are tired.
Discussed and decided in the second meeting, camel case is it.
Preface: I confess I am quite a fan of naming conventions, and in the company I work I try to get people to adhere to the naming conventions we decided together quite strictly. I am aware that in an open-source project like Monero it's more complicated and more difficult to agree on something, or at least to not disagree too much, and most of the time renames of even very bad names are out of question anyway because sometimes this results in changes over the whole codebase, almost impossible to review.
Still, if I see something that I deem important regarding naming, and relevant for our project of writing a Seraphis wallet, I will open an issue for it. Thanks for your patience :)
The Monero codebase pretty consistently uses snake case as naming convention for mostly everything. That's those all-lowercase names with underscores to separate words like e.g.
update_blockchain_height
orwallet_internal_error
. That's no surprise, I think it's pretty universal that C++ code uses that; also the STL and Boost use it, for example (std::range_error
,boost::unordered_map
).For types including structures and classes however there is another naming convention that many people use, CamelCase.
And that's the reason to write this issue: The Seraphis library currently does use CamelCase in this way. Examples:
struct SpEnote
,struct SpOutputProposal
,class MockLedgerContext
,class EnoteScanningContextLedger
. (Everything else uses snake case.)The question I would like to submit to discussion with this issue: In the Seraphis wallet, do we continue the style of the library and use CamelCase for type names, or do we go with the bulk of the code in the Monero codebase and use snake case also for type names?