4 ms·
All languages "support" headers in the sense that you can write up the interface for your code in a separate file from the code itself. There's nothing stopping
by chc 15y ago
All languages "support" headers in the sense that you can write up the interface for your code in a separate file from the code itself. There's nothing stopping you from doing this is Ruby — it simply isn't required.
Most people don't do this because it wouldn't be useful. The reason headers came into being has nothing to do with providing useful information to humans. Headers exist because the C compiler needs everything to be declared (but not necessarily defined) before it is used. That is the problem that headers solve. They also happen to be kind of handy to glance at and see the interface to some code, but that's just a positive externality.
You describe documentation as "inventing a solution to an artificial problem," but it's actually the other way around: Headers are a poor man's documentation. At worst, generated documentation tells you exactly what would be written in a lazily-done header: the names and types of things in the accompanying code. But documentation can also include a lot more detail than that, and often does. Headers can't unless you simply embed your documentation in the header.