Ian Lance Taylor <i...@golang.org> writes:

>> For us, it *did* break P1 in the sense that this silently changing its
>> semantics.  And how about the following?
>>
>>   type P1 struct {
>>     P2
>>     P3
>>   }
>>
>>   type P2 struct {
>>     P4
>>   }
>>
>>   type P3 struct {
>>     P5
>>   }
>>
>>   type P4 struct {
>>     foo int
>>   }
>>
>>   type P5 struct {
>>     // foo int
>>   }
>>
>> P2 and P3 don't know each other.  P1 breaks if P5 gets another foo.
>> It's almost the same (except composition depth), isn't it?
>
> Yes.  You are only safe from changes deeper in the type hierarchy if
> you only reference fields defined without embedding in the types that
> you embed directly.

Understood.

Note to self: when accessing things with a composition depth >1, Thou
shalt be explicit.

Thanks for the explanation!

-- 
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