Descriptionspec: apply method sets, embedding to all types, not just named types
When we first wrote the method set definition, we had long
discussions about whether method sets applied to all types
or just named types, and we (or at least I) concluded that it
didn't matter: the two were equivalent points of view, because
the only way to introduce a new method was to write a method
function, which requires a named receiver type.
However, the addition of embedded types changed this.
Embedding can introduce a method without writing an explicit
method function, as in:
var x struct {
sync.Mutex
}
var px *struct {
sync.Mutex
}
var _, _ sync.Locker = &x, px
The edits in this CL make clear that both &x and px satisfy
sync.Locker. Today, gccgo already works this way; 6g does not.
Patch Set 1 #Patch Set 2 : diff -r 2be444b4df80 https://go.googlecode.com/hg/ #Patch Set 3 : diff -r 2be444b4df80 https://go.googlecode.com/hg/ #
Total comments: 2
Patch Set 4 : diff -r 6ac64dcb6fad https://go.googlecode.com/hg/ #MessagesTotal messages: 7
|