On Tuesday, 23 February 2021 at 07:01:27 UTC+1 Henry wrote: > I think the problem is that people try to use embedding in place of > inheritance. [...] Embedding shares many similarities to inheritance
The first part is a real common problem but I have to admit I do not understand where the second part originates from: Embedding has _nothing_ in common with inheritance. The syntactic sugar of method promotion has a priori nothing to do with embedding and embedding basically lacks any property defining what inheritance is. To me it is really astonishing how often e.g. on Stackoverflow people come up with elaborate Animal-Speak-Dog-Bark-Cat-Miaow variations based on embedding which just don't work, well of course because embedding is not and cannot be used to mimic inheritance. Even with the syntactic sugar of method promotion. Maybe the FAQ or other introductory material should contain a paragraph like: "Can I model inheritance with embedding? No, sorry, this is not possible." And "But if I try very hard and do clever stuff?" No, it still is not inheritance. It simply cannot be done, no matter how hard you try and how clever your code mights seem. V. -- 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/b2290a39-9229-4c7c-a629-aa19ca760cban%40googlegroups.com.