--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/7f471eba-be08-4d32-a50a-22939f63b76dn%40googlegroups.com.
The trick with this kind of approach is understanding what should
happen if the type with a package-specified method is converted to an
empty interface type, handed to some other package, and then in some
way handed back to the original package. Does the package-specified
method survive these conversions? Why or why not? Also, how does
type reflection work: can it discover such methods? Can it discover
them in a different package? There may be answers here but they don't
jump out as obvious.
I would think that, in order to have extension methods be promoted, it would need to be done explicitly. If you could embed a type like pkg(T) which layered the extension methods defined in package pkg on top of the inherent methods of type T, then extension methods wouldn't need to be promoted in the general case. Otherwise, extension methods most likely just wouldn't be promoted.