mirror of
https://github.com/golang/go
synced 2024-11-22 06:34:40 -07:00
go spec: correct clarification of type declaration
R=rsc, r CC=golang-dev https://golang.org/cl/855043
This commit is contained in:
parent
ec53627ed5
commit
d4a1619733
@ -1704,11 +1704,9 @@ last non-empty expression list.
|
|||||||
<p>
|
<p>
|
||||||
A type declaration binds an identifier, the <i>type name</i>, to a new type
|
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
|
that has the same definition (element, fields, channel direction, etc.) as
|
||||||
an existing type. With the exception of interface types, the new type is
|
an existing type. The new type is
|
||||||
<a href="#Properties_of_types_and_values">compatible</a> with, but
|
<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 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>
|
</p>
|
||||||
|
|
||||||
<pre class="ebnf">
|
<pre class="ebnf">
|
||||||
@ -1739,7 +1737,7 @@ type Cipher interface {
|
|||||||
<p>
|
<p>
|
||||||
The declared type does not inherit any <a href="#Method_declarations">methods</a>
|
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>
|
bound to the existing type, but the <a href="#Types">method set</a>
|
||||||
of elements of a composite type or of an interface type is not changed:
|
of an interface type or of elements of a composite type remains unchanged:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
@ -1757,8 +1755,7 @@ type PrintableMutex struct {
|
|||||||
Mutex
|
Mutex
|
||||||
}
|
}
|
||||||
|
|
||||||
// MyCipher is an interface type that has the same method set as Cipher;
|
// MyCipher is an interface type that has the same method set as Cipher.
|
||||||
// it is indistinguishable from Cipher.
|
|
||||||
type MyCipher Cipher
|
type MyCipher Cipher
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user