• Russ Cox's avatar
    spec: apply method sets, embedding to all types, not just named types · 8e38b17a
    Russ Cox authored
    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.
    
    R=golang-dev, gri, iant, r
    CC=golang-dev
    https://golang.org/cl/5702062
    8e38b17a
Name
Last commit
Last update
..
articles Loading commit data...
codewalk Loading commit data...
devel Loading commit data...
gopher Loading commit data...
play Loading commit data...
progs Loading commit data...
talks Loading commit data...
ExpressivenessOfGo.pdf Loading commit data...
Makefile Loading commit data...
button_background.png Loading commit data...
code.html Loading commit data...
codereview_with_mq.html Loading commit data...
contrib.html Loading commit data...
contribute.html Loading commit data...
debugging_with_gdb.html Loading commit data...
docs.html Loading commit data...
effective_go.html Loading commit data...
effective_go.tmpl Loading commit data...
gccgo_contribute.html Loading commit data...
gccgo_install.html Loading commit data...
go-logo-black.png Loading commit data...
go-logo-blue.png Loading commit data...
go-logo-white.png Loading commit data...
go1.html Loading commit data...
go1.tmpl Loading commit data...
go1compat.html Loading commit data...
go_faq.html Loading commit data...
go_mem.html Loading commit data...
go_spec.html Loading commit data...
godocs.js Loading commit data...
ie.css Loading commit data...
install-source.html Loading commit data...
install.html Loading commit data...
logo-153x55.png Loading commit data...
logo.png Loading commit data...
makehtml Loading commit data...
play_overlay.png Loading commit data...
playground.html Loading commit data...
popups.js Loading commit data...
reference.html Loading commit data...
root.html Loading commit data...
sieve.gif Loading commit data...
style.css Loading commit data...
tmpltohtml.go Loading commit data...
video-001.png Loading commit data...
video-002.png Loading commit data...
video-003.png Loading commit data...
video-004.png Loading commit data...
video-005.jpg Loading commit data...