summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2010-03-31 16:37:22 -0700
committerRobert Griesemer <gri@golang.org>2010-03-31 16:37:22 -0700
commit77bcd3a62b91c5a73daba61be5d9ff4a3e6f1484 (patch)
tree8d9faf753e81f24d09cfba5a3906105e816010a2
parent2d6f17f3e2c711b9feed5fb67c5e1ac84116fed6 (diff)
downloadgolang-77bcd3a62b91c5a73daba61be5d9ff4a3e6f1484.tar.gz
go spec: clarification of type declarations
R=r, rsc CC=golang-dev http://codereview.appspot.com/849044
-rw-r--r--doc/go_spec.html10
1 files changed, 8 insertions, 2 deletions
diff --git a/doc/go_spec.html b/doc/go_spec.html
index 84480f6e8..4a4fa5023 100644
--- a/doc/go_spec.html
+++ b/doc/go_spec.html
@@ -1704,9 +1704,11 @@ last non-empty expression list.
<p>
A type declaration binds an identifier, the <i>type name</i>, to a new type
that has the same definition (element, fields, channel direction, etc.) as
-an existing type. The new type is
+an existing type. With the exception of interface types, the new type is
<a href="#Properties_of_types_and_values">compatible</a> with, but
<a href="#Properties_of_types_and_values">different</a> from, the existing type.
+A newly defined interface type is always
+<a href="#Properties_of_types_and_values">identical</a> to the existing type.
</p>
<pre class="ebnf">
@@ -1737,7 +1739,7 @@ type Cipher interface {
<p>
The declared type does not inherit any <a href="#Method_declarations">methods</a>
bound to the existing type, but the <a href="#Types">method set</a>
-of elements of a composite type is not changed:
+of elements of a composite type or of an interface type is not changed:
</p>
<pre>
@@ -1754,6 +1756,10 @@ type NewMutex Mutex
type PrintableMutex struct {
Mutex
}
+
+// MyCipher is an interface type that has the same method set as Cipher;
+// it is indistinguishable from Cipher.
+type MyCipher Cipher
</pre>
<p>