Oops, got that the wrong way round. Should read "allow passing a Bar for argument of type Foo". Cheers, Mike
*“I want you to act as if the house was on fire. Because it is.” — Greta Thunberg* On Sat, Jun 8, 2019 at 5:22 PM Michael Ellis <michael.f.el...@gmail.com> wrote: > > On Friday, June 7, 2019 at 3:01:04 PM UTC-4, Burak Serdar wrote: >> >> >> If one library defines string.Render() for html, and another defines >> another string.Render() for, say, a graphics library, which Render >> will be called when I call "str".Render()? >> >> Thanks for the explanation. That makes sense. Thinking it over, I'm > wondering what would be required for the compiler to recognize synonyms of > the form 'type Foo Bar' and allow passing a Foo for an argument of type > Bar. The compiler knows the expected type of each function argument so it > seems as if checking to see if a passed argument is a simple synonym for > the expected type and doing a coercion doesn't seem like a big task. Note > that this is different than asking for, say, numeric conversion from int to > float64 because those types are not synonyms. I actually like the fact > that Go forces you to explicitly convert numeric types. > > > -- > You received this message because you are subscribed to a topic in the > Google Groups "golang-nuts" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/golang-nuts/L8XXHw9eiqM/unsubscribe. > To unsubscribe from this group and all its topics, 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/aa26152a-fc5c-4048-9d30-446960df0ea9%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/aa26152a-fc5c-4048-9d30-446960df0ea9%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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/CAK6kDbZx%2BwNNm7A7bx7Fx%2BDWQqy7qcBbtZiXoZaFbEqeNaZR8g%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.