On Friday, 21 August 2020 20:15:46 UTC+2, burak serdar wrote: > > [...]
> I don't see why anybody would find it attractive as a return type. People > don't use the empty interface because they like it so much, but because Go > doesn't have parametric polymorphism / "generics" yet. There are many > programming languages that have a named top type and it is rarely abused. > Programmers want to write type safe code if they can. > > I disagree. Especially people coming from other languages with a > strong emphasis on DRY tend to overuse interface{}, many times > incorrectly, and generics will not fix that. "any" will make it more > attractive, because it no longer looks like an interface. I agree that > this is a hypothetical problem at this point without any actual > complaints from developers. But defining an alias "any" is easy if you > need it. Providing one predefined is endorsing its use. > Adopting Go because people adopted bad habits in other languages is probably not a good idea. Fanatic DRY is a bad idea in any language and if somebody wants to footgun himself by premature DRY ing up he will be as able with interface{} as with any. I find a predefined any very sensible. 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/ba2f8502-9586-4179-8736-dbe1b3c31ca9o%40googlegroups.com.