On Fri, Aug 21, 2020 at 7:43 AM 'Carla Pfaff' via golang-nuts <golang-nuts@googlegroups.com> wrote: > > On Friday, 21 August 2020 at 14:57:13 UTC+2 bbse...@gmail.com wrote: >> >> interface{}, when used as a constraint, doesn't mean than the value >> has to be an interface{}, it means the value can be anything. >> interface{}, when used as a value, doesn't mean that the value can be >> anything, it means that the value is an interface, and you have to get >> the value from that interface. Different uses, different identifiers. > > > The same is true for "interface{String() string}" as a constraint and > "interface{String() string}" as a type. > Does that mean that you want to allow the identifier "fmt.Stringer" only for > constraints, but not for types?
All constraints except "any" specify a constraint for the type. A Stringer constraint will ensure that the type has String() string method. "any" is a lack of constraint. I think the two concepts are different. My problem is the attractiveness of "any" as a return type. I can live with it, but I expect to see more questions raised about functions returning "any" values behaving weird in a nil-check. > > -- > 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/4c9a2735-3e22-4568-ac0b-8c6a8b4b8583n%40googlegroups.com. -- 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/CAMV2RqrUdiTFs20uuPLTLf40yz2bHJZRM-ihcH%3DUD7STrzt2Kg%40mail.gmail.com.