Live data from Hacker News

Apple's Module proposal to replace headers for C-based languages [pdf]

llvm.org

31–40 of 187 posts

Re: Apple's Module proposal to replace headers for C-based languages [pdf]

#31
post #29

While LLVM authors probably know best, I don't understand some of his criticisms on the "Inherently Non-Scalable" slide. • M headers with N source files -> M x N build cost It's only MxN if there is no use of the "#ifndef _HEADER_H" workaround that he mentioned earlier. Wouldn't adding a preprocessor directive like "#include_once " solve this? Alternatively, these guards could be added to the headers themselves withou…

[deleted]

Re: Apple's Module proposal to replace headers for C-based languages [pdf]

#32
post #29

While LLVM authors probably know best, I don't understand some of his criticisms on the "Inherently Non-Scalable" slide. • M headers with N source files -> M x N build cost It's only MxN if there is no use of the "#ifndef _HEADER_H" workaround that he mentioned earlier. Wouldn't adding a preprocessor directive like "#include_once " solve this? Alternatively, these guards could be added to the headers themselves withou…

It's only MxN if there is no use of the "#ifndef _HEADER_H" workaround that he mentioned earlier.

There still is a processing cost for evaluating the instruction

Re: Apple's Module proposal to replace headers for C-based languages [pdf]

#33
post #29

While LLVM authors probably know best, I don't understand some of his criticisms on the "Inherently Non-Scalable" slide. • M headers with N source files -> M x N build cost It's only MxN if there is no use of the "#ifndef _HEADER_H" workaround that he mentioned earlier. Wouldn't adding a preprocessor directive like "#include_once " solve this? Alternatively, these guards could be added to the headers themselves withou…

Instead of "#ifndef _SOME_HOPEFULLY_UNIQUE_NAME_H" I've started using "#pragma once" -- it's likely supported by every compiler you care about.

http://en.wikipedia.org/wiki/Pragma_once

Re: Apple's Module proposal to replace headers for C-based languages [pdf]

#34
post #29

While LLVM authors probably know best, I don't understand some of his criticisms on the "Inherently Non-Scalable" slide. • M headers with N source files -> M x N build cost It's only MxN if there is no use of the "#ifndef _HEADER_H" workaround that he mentioned earlier. Wouldn't adding a preprocessor directive like "#include_once " solve this? Alternatively, these guards could be added to the headers themselves withou…

Wouldn't adding a preprocessor directive like "#include_once " solve this?

No, that means that for foo.c a given header is only added once. It doesn't prevent bar.c from importing and recompiling that same header.

Re: Apple's Module proposal to replace headers for C-based languages [pdf]

#35
post #29

While LLVM authors probably know best, I don't understand some of his criticisms on the "Inherently Non-Scalable" slide. • M headers with N source files -> M x N build cost It's only MxN if there is no use of the "#ifndef _HEADER_H" workaround that he mentioned earlier. Wouldn't adding a preprocessor directive like "#include_once " solve this? Alternatively, these guards could be added to the headers themselves withou…

> Wouldn't adding a preprocessor directive like "#include_once " solve this?

No -- the point is still that you recompile each header for each source file that uses it. Running the compiler N times (once for each source file) costs M x N, not M + N.

> Why is this?

I agree with you here, I think this dismissal of precompiled headers needs a more thorough explanation (but perhaps it was given orally in the talk).

Re: Apple's Module proposal to replace headers for C-based languages [pdf]

#36
post #25
post #16

Earlier quoted context omitted.

First slide. It seems like he's employed by Apple and being paid to work on this. So yes, I think calling it Apple's solution an apt description.

Herb Stutter heads the C++ standards committee and credits his employer Microsoft [1]. Is C++11 or C++17 "Microsoft's"? [1] http://isocpp.org/std/the-committee

The standards don't belong to anybody. Particular proposals are credited to the person or organization that propose them.

This particular proposal is from Apple.

When Herb Sutter/Microsoft make proposals for C++, it's phrased as "Microsoft's proposal for C++0x" or whatever.

Re: Apple's Module proposal to replace headers for C-based languages [pdf]

#37
post #24

It the risk of starting a fight, I really don't want this. I'm quite happy with headers and know how to effectively manage them without shooting myself. Granted there is some compiler overhead for importing large header files but I don't really notice it at all. Also, we already have an Apple/Next non-standard C extension (objective-C). I don't think we want anything else added without proper standardisation regardle…

> Also, we already have an Apple/Next non-standard C extension (objective-C). I don't think we want anything else added without proper standardisation regardless of the motivation. I'd rather they forked the language.

This is confusing. Surely Objective-C, which adds a hell of a lot that C does not address and many syntax and runtime changes to support it, would fall under the definition of "fork of the language", rather as C++ does, rather than simply a "non-standard C extension" (surely that description better applies to the many GNU C extensions in GCC?).

Re: "adding things without proper standardization", the role of standards committees is to reach consensus among vendors so that they can standardize non-standard extensions that they have variously implemented and tested in the real world first. To argue for the opposite, that the vendors must do nothing until the committee hands down the One True Way from On High, untested outside of their heads, is the height of Design By Committee.

Re: Apple's Module proposal to replace headers for C-based languages [pdf]

#38
the one problem i agree with him on is performance - from what i can see his proposal does something to potentially improve that, but its not clear. i worry that caching pre-processed files is a red herring - its it really faster than re-including? what about preprocessor states? what about macros in include files? etc.

i feel that the preprocessor ultimately ends up with the same amount of work, just an extra pass for each included header to build a version to be cached… not to mention the complexity required to handle the multiplicity of pre-processor states required for this. maybe i am being dim and missing the obvious.

tbh, i'd rather they made their compiler work properly, like respecting alignment on copies with optimisation turned on, or implementing the full C++ 11, before adding language features to fix problems that nobody really has.

Re: Apple's Module proposal to replace headers for C-based languages [pdf]

#39
post #7
post #2

This looks promising, aside from being long overdue. Header files have always been one of the more annoying parts of C/C++/Obj-C development. The important bit is that the proposal's ideas for making the transition easier are good and make it seem like this may get traction where similar efforts have failed before. That Doug Gregor and other LLVM/Clang/LLDB developers are already working on the Clang implementation i…

I think it is promising and long overdue, too. It also is clear to me that this will win, because Apple pushes it into LLVM, and has a head start at it. On the other hand: if someone would do the equivalent to their browser, people would call it fragmentation. It will be interesting to see how gcc reacts to this. If this decreases compilation times significantly, I think they will have to follow suit.

> On the other hand: if someone would do the equivalent to their browser, people would call it fragmentation.

I haven’t seen many people calling Dart, Pepper, Native Client or the Chrome Web Store “fragmentation”.

Re: Apple's Module proposal to replace headers for C-based languages [pdf]

#40
post #24

It the risk of starting a fight, I really don't want this. I'm quite happy with headers and know how to effectively manage them without shooting myself. Granted there is some compiler overhead for importing large header files but I don't really notice it at all. Also, we already have an Apple/Next non-standard C extension (objective-C). I don't think we want anything else added without proper standardisation regardle…

I can't figure out what you're opposed to. Wouldn't you like to avoid the risk and effort of managing headers yourself? Wouldn't you want to avoid pointless compiler overhead?

As for standardization, Doug Gregor is on the standardization committee.

Post reply on HN