I recently read the post by Rob Pike about language choices for 
Golang: https://talks.golang.org/2012/splash.article#TOC_5.

The seventh point refers to how Golang handles dependencies. It mentions an 
"object file" for packages that a _dependent_ reads.

Below I go through my interpretation of this section:

Example:

package A imports package B.

When I compile package A, package B would have already been compiled. What 
package A receives is not the AST of package B, but an "Object file". This 
object file only reveals data about the publicly accessible symbols in that 
package. From the example, if B had a private struct defined inside of it, 
this private struct would not be in the object file.

This part seems to make sense for me, hopefully I did not make any mistakes.

It seems that the speedup compared to C/C++ is because the object file is 
created once per package, while in C/C++ you need to re-compile the thing 
you are including each time?

Followup question:

Is a single file a compilation unit or is it a package?

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/eaa534b5-193c-474b-a349-7a92b6e94392n%40googlegroups.com.

Reply via email to