This prints "foo=2" which surprised me because I was unaware that T1
had got another foo via T3 (with less composition depth).

If I put T4 directly into T1, Go would detect the ambiguity of t1.foo
(because the composition depth is the same).

There is no ambiguity because `T4.foo` is not promoted to a field of `T1`. `T4.foo` *is* a promoted field of `T2` but promotion is not transitive.

see https://play.golang.org/p/GFgJGTSGGd

Read about this on:

*  https://golang.org/ref/spec#Struct_types
* https://golang.org/ref/spec#Selectors

Lutz

--
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to