News for hackers. Stuff that matters.
Re:Apple's Module proposal to replace headers for C-based la... by aidenn0 on Monday November 26, 2012 @03:41PM (#4833914)
I know nothing about this proposal, but I can make educated guesses on all of these:

Creating header: the module needs only the public information for a closed source module. You could generate it from a .h file if you are a consumer of a closed source module, or if you are the producer of the module, you could potentially ship either pre-generated modules or all the information needed to generate a module.

javadoc, etc. It sounds like you could generate the information directly from the C/C++ source since there is now information about what is public and private in the source

Compiling this: template <typename Type> Type max(Type a, Type b) { return a > b ? a : b; } Generates no code, but it does some work in the compiler that can be cached. This is what would be stored in the module.

Re:Apple's Module proposal to replace headers for C-based la... by vilya on Monday November 26, 2012 @06:22PM (#4834584)
Thanks, I think you're probably right - the modules would have to have enough information in their compiled form that your compiler could introspect them without needing the source. The proposal wouldn't be much use if that weren't true.

Re: templates, I thought the expensive part of template processing was code generation rather than parsing. Would caching the AST really be that much of a saving? I admit I've never tried profiling it to find out...

Re:Apple's Module proposal to replace headers for C-based la... by aidenn0 on Saturday December 01, 2012 @12:20AM (#4856928)
#include <iostream>

You've just parsed ~6MB of code. You might instantiate 2 or 3 templates from it. The parsing truly is non-trivial.