On Wed, Oct 25, 2017 at 1:43 AM, Harald Fuchs wrote:
>
> I got bitten by what I'd say is a misfeature in Go:
>
> type T1 struct {
> T2
> T3
> }
>
> type T2 struct {
> T4
> }
>
> type T3 struct {
> foo int
> }
>
> type T4 struct {
> foo int
>
On Wed, Oct 25, 2017 at 11:02 AM, Lutz Horn wrote:
> 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
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
I got bitten by what I'd say is a misfeature in Go:
type T1 struct {
T2
T3
}
type T2 struct {
T4
}
type T3 struct {
foo int
}
type T4 struct {
foo int
}
func main() {
t1 := T1{
T2{
T4{
1,
},
},
T3{