Thank you Axel for quoting the spec. On Thursday, February 27, 2025 at 10:55:58 PM UTC+1 Axel Wagner wrote:
> For a value x of type T or *T where T is not a pointer or interface type, x.f denotes the field or method *at the shallowest depth* in T where there is such an f. If there is not exactly one f with shallowest depth, the selector expression is illegal. The field `meter.EqualName` has a more shallow depth than `meter.EqualName.EqualName`, thus `m.EqualName` denotes the field, not the method. Thus, the method is not promoted. Thus `meter` has no `EqualName` method, as the only way it could get one is by promotion. I can see why the EqualName method is not promoted. However, there is still the EqualName field. Even if it's not useful (since zero value) I would expect this fields to make meter implement the EqualName interface. See https://play.golang.com/p/awtbP1X93Pg for an example that shows that presence of an interface field is enough. Thanks, Andi -- 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 visit https://groups.google.com/d/msgid/golang-nuts/b4d16a1e-1c31-4cbb-8774-fc7b9d960d5fn%40googlegroups.com.