mirror of
https://github.com/golang/go
synced 2024-11-24 19:40:09 -07:00
disallow interface {x, y()}
R=gri DELTA=8 (3 added, 0 deleted, 5 changed) OCL=35045 CL=35047
This commit is contained in:
parent
fc61b77754
commit
13dac655cb
@ -49,7 +49,7 @@ and convert §Foo into §<a href="#Foo">Foo</a>:
|
|||||||
|
|
||||||
<div id="content">
|
<div id="content">
|
||||||
|
|
||||||
<h1 id="The_Go_Programming_Language_Specification">The Go Programming Language Specification</h1>
|
<h1 id="The_Go_Programming_Language_Specification">The Go Programming Language Specification</h1>
|
||||||
|
|
||||||
|
|
||||||
<!-- The Table of Contents is automatically inserted in this <div>.
|
<!-- The Table of Contents is automatically inserted in this <div>.
|
||||||
@ -923,15 +923,16 @@ that is any superset of the interface. Such a type is said to
|
|||||||
<pre class="ebnf">
|
<pre class="ebnf">
|
||||||
InterfaceType = "interface" "{" [ MethodSpecList ] "}" .
|
InterfaceType = "interface" "{" [ MethodSpecList ] "}" .
|
||||||
MethodSpecList = MethodSpec { ";" MethodSpec } [ ";" ] .
|
MethodSpecList = MethodSpec { ";" MethodSpec } [ ";" ] .
|
||||||
MethodSpec = IdentifierList Signature | InterfaceTypeName .
|
MethodSpec = identifier Signature | InterfaceTypeName .
|
||||||
InterfaceTypeName = TypeName .
|
InterfaceTypeName = TypeName .
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
// A simple File interface
|
// A simple File interface
|
||||||
interface {
|
interface {
|
||||||
Read, Write (b Buffer) bool;
|
Read(b Buffer) bool;
|
||||||
Close ();
|
Write(b Buffer) bool;
|
||||||
|
Close();
|
||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
@ -972,7 +973,8 @@ to define an interface called <code>Lock</code>:
|
|||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
type Lock interface {
|
type Lock interface {
|
||||||
Lock, Unlock ();
|
Lock();
|
||||||
|
Unlock();
|
||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
@ -999,7 +1001,8 @@ in the interface.
|
|||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
type ReadWrite interface {
|
type ReadWrite interface {
|
||||||
Read, Write (b Buffer) bool;
|
Read(b Buffer) bool;
|
||||||
|
Write(b Buffer) bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
type File interface {
|
type File interface {
|
||||||
@ -4550,7 +4553,7 @@ Calls to <code>Alignof</code>, <code>Offsetof</code>, and
|
|||||||
<p>
|
<p>
|
||||||
The functions <code>unsafe.Typeof</code>,
|
The functions <code>unsafe.Typeof</code>,
|
||||||
<code>unsafe.Reflect</code>,
|
<code>unsafe.Reflect</code>,
|
||||||
and <code>unsafe.Unreflect</code> allow access at run time to the dynamic
|
and <code>unsafe.Unreflect</code> allow access at run time to the dynamic
|
||||||
types and values stored in interfaces.
|
types and values stored in interfaces.
|
||||||
<code>Typeof</code> returns a representation of
|
<code>Typeof</code> returns a representation of
|
||||||
<code>val</code>'s
|
<code>val</code>'s
|
||||||
|
Loading…
Reference in New Issue
Block a user