News for hackers. Stuff that matters.
Re:Building C Projects by tujv on Wednesday November 05, 2014 @05:58PM (#8564773)
By contrast, the Plan 9 C compiler does use the header when linking. Header files contain a prama statement with library name, removing the need for linker flags.

See: http://plan9.bell-labs.com/sys/doc/comp.html

Re:Building C Projects by melling on Wednesday November 05, 2014 @08:44PM (#8565382)
And when Rob Pike decided to create Go from that compiler, he just got rid of headers.
Re:Building C Projects by pjmlp on Thursday November 06, 2014 @03:37AM (#8566245)
Because the Go team did the right thing by adopting modules, which are as old as C in the computing world.
Re:Building C Projects by swah on Thursday November 06, 2014 @05:00AM (#8566413)
What do you mean by "modules" here?
Re:Building C Projects by pjmlp on Thursday November 06, 2014 @05:13AM (#8566434)
Go actually calls them packages.

I just prefer the term modules, as it was introduced by Mesa and CLU in the 70's.

Only languages based on C's primitive toolchain rely on basic separate compilation of translation units with textual includes for symbol definition.

Modular languages, that make use of better toolchains, couple the concept of separate compilation, with strong type checking across compilation boundaries and compiler managed metadata for the exported symbols.

Re:Building C Projects by swah on Thursday November 06, 2014 @06:02AM (#8566528)
Thanks for the explanation. Do you think the idea of implementation/interface separation, that C and Java allow easily, is also better in Go?
Re:Building C Projects by pjmlp on Thursday November 06, 2014 @07:21AM (#8566677)
I didn't got your question.

Java packages are not that different from Go packages, in terms of CS concepts.

Except for the set of issues that are debated to death about Go, the language is quite modular in Mesa tradition.

Given Oberon's influence in Go's design[1], maybe you will find these books interesting,

From http://www.inf.ethz.ch/personal/wirth/ check "Algorithms and Data Structures", "Project Oberon", "Compiler Construction".

From http://ssw.jku.at/Research/Books/ check Object-Oriented Programming in Oberon-2.

Re:Building C Projects by roel_v on Thursday November 06, 2014 @04:50AM (#8566395)
Linking is a separate step from compiling. It's a lot easier and clearer to keep that distinction. Of course, it's not as convenient, which is why I've fallen for the lure of pragma's in the past - but at some point, it will come back to bite you in the behind (wrong library linked, no library linked because of unusual combination of preproc variables, etc).
Re:Building C Projects by userbinator on Thursday November 06, 2014 @12:56AM (#8565960)
Microsoft's MSVC has this feature too:

http://msdn.microsoft.com/en-us/library/7f0aews7.aspx

Re:Building C Projects by ygra on Thursday November 06, 2014 @12:53AM (#8565959)
Some libraries do the same in Visual Studio, e.g. Boost. But you'd have a hard time finding the exact library name to link against there as well.