Re: [go-nuts] Re: How does the Golang compiler handle dependencies?

2020-11-17 Thread Haddock
Here is an article by Walter Bright that explains what the C++ compiler is doing: https://www.digitalmars.com/articles/b54.htm l Walter Bright is the creator of the first C++ compiler (if I remember right this was the Zortech C++ compiler, later

Re: [go-nuts] Re: How does the Golang compiler handle dependencies?

2020-11-15 Thread Aleksey Tulinov
Yeah, that's a good point. A C unit that is using f() won't necessarily include f's implementation if it is defined somewhere else. It may create a (weak?) reference to f() and leave the rest to the linker. However to compile correctly it would *normally* include a header where f() is declared to

Re: [go-nuts] Re: How does the Golang compiler handle dependencies?

2020-11-15 Thread Robert Engels
Object files do not contain dependencies except for code that the compiler inlines. It has linkage referees that are resolved during linking. > On Nov 15, 2020, at 8:05 AM, kev kev wrote: > > Reading Alekseys description, it does seem to be making a bit more sense. > The C/C++ compilers use

Re: [go-nuts] Re: How does the Golang compiler handle dependencies?

2020-11-15 Thread kev kev
Reading Alekseys description, it does seem to be making a bit more sense. The C/C++ compilers use a "file" as a compilation unit. A file is converted to an object file which must contain all of its dependencies. So the includes will need to copy all of the code that they are importing into the

Re: [go-nuts] Re: How does the Golang compiler handle dependencies?

2020-11-14 Thread Jesper Louis Andersen
On Sat, Nov 14, 2020 at 2:54 AM kev kev wrote: > Oh right, I seem to not understand why golang is faster in that respect. > If you can include the precompiled headers and or have an object file > > The key point is that in C++, declarations in header files tend to be leaky, especially in larger

Re: [go-nuts] Re: How does the Golang compiler handle dependencies?

2020-11-13 Thread Aleksey Tulinov
There is no direct relationship between headers and object files in C or C++. Compilation process is two stage: 1. Source files are compiled into object files 2. Object files are linked together into executable of sorts (Actually it's a three stage process, but i'm going to describe it using two

Re: [go-nuts] Re: How does the Golang compiler handle dependencies?

2020-11-13 Thread Robert Engels
I think a lot is because a lack of macros. With macros it is difficult to figure out changed dependencies. > On Nov 13, 2020, at 7:55 PM, kev kev wrote: > > Oh right, I seem to not understand why golang is faster in that respect. If > you can include the precompiled headers and or have an

Re: [go-nuts] Re: How does the Golang compiler handle dependencies?

2020-11-13 Thread kev kev
Oh right, I seem to not understand why golang is faster in that respect. If you can include the precompiled headers and or have an object file On Saturday, 14 November 2020 at 01:21:51 UTC ren...@ix.netcom.com wrote: > In C there are precompiled headers which avoid the recompilation. > > On

Re: [go-nuts] Re: How does the Golang compiler handle dependencies?

2020-11-13 Thread Robert Engels
In C there are precompiled headers which avoid the recompilation. > On Nov 13, 2020, at 7:18 PM, kev kev wrote: > >  > Thanks for the answer. If C/C++ has object files, is it not possible to see > “something.h” and then fetch the corresponding object file? > > With go, if I import “package

[go-nuts] Re: How does the Golang compiler handle dependencies?

2020-11-13 Thread kev kev
Thanks for the answer. If C/C++ has object files, is it not possible to see “something.h” and then fetch the corresponding object file? With go, if I import “package something” and that package imports another package called “package bar” then at some point I will need to compile “bar” and

[go-nuts] Re: How does the Golang compiler handle dependencies?

2020-11-13 Thread 'Kevin Chowski' via golang-nuts
C/C++ also has object file caching (depending on how your build is set up, I guess). In C/C++ the issue is that you need to possibly open a large number of header files when you import any header file. For example, if I write a file "main.c" which imports "something.h", which in turn imports