3 ms·
I recon it is similar to the desire for header-only C libs, package management isn’t great, so single files are easier to deal with. I wonder if anyone has made
by DougBTX 7y ago
I recon it is similar to the desire for header-only C libs, package management isn’t great, so single files are easier to deal with. I wonder if anyone has made a Python package manager based on the idea of bundling up all the files in a Python project into a single .py file that can just be downloaded and copied around as-is? No requirements.txt, just vendored .py files in a libs dir.
- asveikau 7y agoHeader only c libs also emerge from c and c++ realities that are less true elsewhere. The biggest one is the optimizer does a better job when stuff is in the same compilation unit. (Inlining and stuff.) A good example to look at is sqlite, which is developed as multiple files but they concatenate them together for distribution. Another reason is a C++ one, and C is not C++ but the community has enough overlap that I think it tends to spill over. And that is templates. Templates need to be in the header so a lot of c++ libraries have complicated, slow to compile headers. I do think, for example when any given person on HN links to a header only C or C++ library, that a lot of these people are overdoing it. They have likely not measured it and found it to be better like the sqlite people. They are fighting, perhaps even misunderstanding the tooling, at the cost of compile times and large binary sizes. And for what? Makefiles are not really that hard to write.