News for hackers. Stuff that matters.
Re:Apple's Module proposal to replace headers for C-based la... by SeoxyS on Monday November 26, 2012 @07:46PM (#4834895)
I think I'm the only person who likes headers. I'm not overly concerned with compilation times and big-o notation. Computers can compile things really fast nowadays.

I'm more concerned with the developer usability benefits & drawbacks of the feature. As somebody who is a polyglot, but spends a large amount of time writing Objective-C, I have come to absolutely love header files.

I see header files almost as documentation. To me, a header file is a description of everything that's public about an API. My header files tend to be very well commented, and very sparse, only containing public methods and typedefs.

When the need arises to make internally-includable headers (say I'm writing a static library, and have methods that are private to the library, but public to other classes within the library), I will usually write a `MyApi+Internal.h` header for internal use, which doesn't ship with the library.

A developer should never have to dig into implementation files, or into documentation, in order to use a library. Its headers ought to be sufficient. Things like private instance variables or anything private does not belong in a header file.

FWIW, here's the public header for the library I spend most of my time working on:

https://gist.github.com/e83169d2c3984c6f077c

Re:Apple's Module proposal to replace headers for C-based la... by gilgoomesh on Monday November 26, 2012 @08:40PM (#4835140)
The headers still exist. This proposal is not about eliminating them. All this proposal does is bundle groups of headers together and give you a simplified way of including them.

If you have a look at the proposed ".map" files, the headers are still fully enumerated. I assume the IDE/debugger will still be able to find definitions in the original header files via the .map files.

Re:Apple's Module proposal to replace headers for C-based la... by nnethercote on Monday November 26, 2012 @08:37PM (#4835111)
> Computers can compile things really fast nowadays.

Not if you're working on a large project. Firefox takes about 15 minutes to build from scratch on my fast Linux box. Getting that down by a factor of 10 or more would be fantastic.

Re:Apple's Module proposal to replace headers for C-based la... by tsahyt on Tuesday November 27, 2012 @01:37PM (#4838061)
No, you're not alone. I view headers as a wonderful way of documentation as well. Usually I've got a header file open on the left side of the screen while working on the implementation on the right side. It's extremely convient to work this way.

I'm aware of the performance issues headers create at compile time but I still like them quite a lot. On the other hand I haven't really been too fond of any module system I've seen so far. Maybe I'm just extremely old fashioned.

Re:Apple's Module proposal to replace headers for C-based la... by masklinn on Tuesday November 27, 2012 @04:47AM (#4836416)
> Computers can compile things really fast nowadays.

Compiling Qt or LLVM from source will quickly put a rest to these unwarranted assertions.

Re:Apple's Module proposal to replace headers for C-based la... by pjmlp on Tuesday November 27, 2012 @03:40AM (#4836252)
> Computers can compile things really fast nowadays.

You are free to take care of our > 1 hour compile time build.

Re:Apple's Module proposal to replace headers for C-based la... by jandrese on Tuesday November 27, 2012 @07:36PM (#4840222)
Most of the time header compilation time isn't a big deal to me either, but then I started working on a project that uses Boost extensively and noticed that even small files were taking several seconds to compile because the headers were so enormous.
Re:Apple's Module proposal to replace headers for C-based la... by anextio on Monday November 26, 2012 @10:45PM (#4835505)
> Computers can compile things really fast nowadays.

Tell that to my fecking codebase.

Re:Apple's Module proposal to replace headers for C-based la... by tikhonj on Monday November 26, 2012 @10:40PM (#4835493)
It sounds like you'd really like OCaml's module interface files (.mli). Or, more generally, all of OCaml's module system. It's very well designed and definitely worth checking out.