Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(572)

Unified Diff: doc/go_spec.html

Issue 849044: code review 849044: go spec: clarification of type declarations (Closed)
Patch Set: code review 849044: go spec: clarification of type declarations Created 15 years ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: doc/go_spec.html
===================================================================
--- a/doc/go_spec.html
+++ b/doc/go_spec.html
@@ -1704,9 +1704,11 @@
<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 @@
<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 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>
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b