Remove unnecessary cpp files after cleanup#108516
Conversation
|
I think this is generally desirable but my concern is the impact of ease of contribution in general without these files, so I's say they server a sufficient purpose if they don't contribute significantly to slow down compilation etc. For example if the headers are moved and there's an open PR adding something to this the rebase will be harder, if the file exists and is just moved then the change will be largely automatic in git assuming you haven't made too large a change |
|
The |
|
But the ones I wanted to remove here do absolutely nothing. |
|
IMO, given that it's "just" 17 files out of thousands, I'd say it's not worth having a case-by-case basis for this, and we should just have the cpp files, at least for all bound classes, it's a drop in the ocean comparatively and I doubt it has any real effect on anything performance wise, but it makes some contribution less smooth Also in some cases I'd say there's a benefit of having the static variables stored in cpp to avoid unnecessary mutation of the header Also repeating with timothyqiu said in dev-chat:
|
I guess you can check if there are open PRs with PR's by file. Still doesn't solve the issue of future PRs needing these files though. |
|
I initially thought that these cpp files only contained empty constructors and static member variable definitions. But it turns out that there are quite a few classes in this PR that have moved their method definitions to the header, thus eliminating the need for the cpp files. I think we should discuss the circumstances under which it is permissible to define functions in header files separately. |
|
Ok so here's a summary of the removed files, sorted from least to most arguable removal:
By "trivial one-liners" I mean methods that only assign or return a member. Many setters/getters fall under this group; I once brought it up on chat. I don't plan to do a cleanup for this, but we could apply this style going forward (if it's generally agreed). And yes, in this PR it's a bit forced for the sake of removing files, hence some of the changes are more arguable. Though IMO aside from the Also to give more context, here are some files that could be considered for removal, but I didn't touch them various reasons: |
|
The only hard-requirements for modules are Lines 237 to 239 in d5cb0f9
|
|
And what about the Web fail? It looks like another case besides the modules. |
Looks like web hardcodes the Lines 30 to 31 in f845aee |
|
Module fix merged; this should be good to go after a rebase! |
|
Thanks! |
Inspired by #106293 and #108340
I noticed that some cpp files are effectively useless. Once you cleanup them (remove empty methods etc.), you end up with empty file. The aforementioned PRs had a few such cases.
I decided to go a step further and just delete all similar files. This PR removes cpp files that are either empty after "obvious" cleanup, or have very trivial code (1-2 one-liner methods, no additional dependencies, no special conditions etc.). Most of these files weren't changed in a long time, so it's unlikely the cpp file will become needed eventually. However I can trim this down to the most obvious cases.