1
0
mirror of https://github.com/golang/go synced 2024-11-19 21:34:45 -07:00
go/doc
Robert Griesemer 2c83f1eaf9 spec: explicitly disallow blank methods in interface types
The spec was unclear about whether blank methods should be
permitted in interface types. gccgo permits at most one, gc
crashes if there are more than one, go/types permits at most
one.

Discussion:

Since method sets of non-interface types never contain methods
with blank names (blank methods are never declared), it is impossible
to satisfy an interface with a blank method.

It is possible to declare variables of assignable interface types
(but not necessarily identical types) containing blank methods, and
assign those variables to each other, but the values of those
variables can only be nil.

There appear to be two "reasonable" alternatives:

1) Permit at most one blank method (since method names must be unique),
and consider it part of the interface. This is what appears to happen
now, with corner-case bugs. Such interfaces can never be implemented.

2) Permit arbitrary many blank methods but ignore them. This appears
to be closer to the handling of blank identifiers in declarations.
However, an interface type literal is not a declaration (it's a type
literal). Also, for struct types, blank identifiers are not ignored;
so the analogy with declarations is flawed.

Both these alternatives don't seem to add any benefit and are likely
(if only slightly) more complicated to explain and implement than
disallowing blank methods in interfaces altogether.

Fixes #6604.

LGTM=r, rsc, iant
R=r, rsc, ken, iant
CC=golang-codereviews
https://golang.org/cl/99410046
2014-05-22 12:23:25 -07:00
..
articles all: fix "the the" typos. 2014-05-20 14:42:07 -04:00
codewalk doc: fix typo in sharemem codewalk 2014-05-21 14:34:20 -07:00
devel doc: document go1.2.2 2014-05-05 09:56:26 -07:00
gopher doc/gopher: fix typo in README 2014-03-26 11:23:33 +11:00
play doc: remove godocs.js and playground.js from core repo 2013-08-01 15:09:18 +10:00
progs doc/progs: don't try building cgo tests if CGO_ENABLED=0 2013-10-11 08:55:13 -07:00
asm.html doc: fix an article 2014-04-27 07:40:48 -07:00
cmd.html doc: re-organize golang.org site content 2013-09-16 15:47:13 +10:00
code.html doc: update installation instructions 2013-11-21 07:55:29 +11:00
contrib.html doc/contrib.html: fix some tags 2013-10-15 18:41:23 +11:00
contribute.html doc/contribute.html: link to wiki for more code review information 2014-04-25 20:09:04 -07:00
debugging_with_gdb.html doc/debugging_with_gdb.html: add introductory disclaimer 2014-04-26 10:18:17 -06:00
docs.html doc: restore race detector manual 2014-02-11 09:26:34 +11:00
effective_go.html doc/effective_go.html: a little more about errors 2014-05-14 13:46:58 -07:00
gccgo_contribute.html doc: update gccgo docs 2013-06-20 14:49:15 -07:00
gccgo_install.html doc: fix broken link to RTEMS Go wiki page 2014-04-28 06:27:22 -07:00
go1.1.html doc: fix a few broken links 2013-10-09 07:05:43 +11:00
go1.2.html encoding/gob: do not use MarshalText, UnmarshalText 2013-11-13 21:29:19 -05:00
go1.3.html doc/go1.3.html: change uintptr to integer in unsafe.Pointer section 2014-05-22 11:45:03 -04:00
go1.html doc: re-organize golang.org site content 2013-09-16 15:47:13 +10:00
go1compat.html doc: re-organize golang.org site content 2013-09-16 15:47:13 +10:00
go_faq.html doc: replace absolute links to golang.org with relative links 2014-05-07 18:49:13 +04:00
go_mem.html doc: allow buffered channel as semaphore without initialization 2014-03-24 19:11:21 -04:00
go_spec.html spec: explicitly disallow blank methods in interface types 2014-05-22 12:23:25 -07:00
go-logo-black.png doc: pngcrush and remove old, unused images 2012-03-08 14:18:28 +11:00
go-logo-blue.png doc: pngcrush and remove old, unused images 2012-03-08 14:18:28 +11:00
go-logo-white.png doc: pngcrush and remove old, unused images 2012-03-08 14:18:28 +11:00
help.html doc/help.html: fix typo in word order 2014-04-14 13:03:03 -07:00
ie.css
install-source.html doc: fix link to Mercurial download 2014-04-28 06:59:27 -07:00
install.html doc/install.html: fix duplicate id= tag 2014-05-20 11:57:21 -07:00
logo-153x55.png doc: pngcrush and remove old, unused images 2012-03-08 14:18:28 +11:00
root.html doc: remove "Code that grows with grace" video from front page 2014-02-11 16:00:44 +11:00
share.png godoc: change link styles, add 'pop out' button 2012-03-13 11:00:11 +11:00
sieve.gif
tos.html doc: add Terms of Service 2012-03-27 09:27:43 +11:00