Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
a1065faf
Commit
a1065faf
authored
Sep 30, 2008
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- corrections and more on interface types
R=r DELTA=35 (12 added, 13 deleted, 10 changed) OCL=16162 CL=16164
parent
b6f59358
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
21 deletions
+20
-21
go_spec.txt
doc/go_spec.txt
+20
-21
No files found.
doc/go_spec.txt
View file @
a1065faf
...
...
@@ -36,7 +36,6 @@ Open issues according to gri:
[ ] optional semicolons: too complicated and unclear
[ ] like to have assert() in the language, w/ option to disable code gen for it
[ ] composite types should uniformly create an instance instead of a pointer
[ ] meaning of nil
[ ] clarify slice rules
[ ] something on tuples?
[ ] semantics of statements
...
...
@@ -62,6 +61,7 @@ Decisions in need of integration into the doc:
for array composites
Closed issues:
[x] meaning of nil
[x] remove "any"
[x] methods for all types
[x] should binary <- be at lowest precedence level? when is a send/receive non-blocking? (NO - 9/19/08)
...
...
@@ -94,13 +94,10 @@ Contents
Export declarations
Types
Type interfaces
Basic types
Arithmetic types
Booleans
Strings
Array types
Struct types
Pointer types
...
...
@@ -743,25 +740,26 @@ There are basic types and composite types. Basic types are predeclared.
Composite types are arrays, maps, channels, structures, functions, pointers,
and interfaces. They are constructed from other (basic or composite) types.
The 'static type' (or simply 'type') of a variable is the type defined by
the variable's declaration. The 'dynamic type' of a variable is the actual
type of the value stored in a variable at runtime. Except for variables of
interface type, the static and dynamic type of variables is always the same.
Variables of interface type may hold values of different types during
execution. However, the dynamic type of the variable is always compatible
with the static type of the variable.
Type =
TypeName | ArrayType | ChannelType | InterfaceType |
FunctionType | MapType | StructType | PointerType .
TypeName = QualifiedIdent.
The ``interface'' of a type is the set of methods bound to it
(§Method declarations). The interface of a pointer type is the interface
of the pointer base type (§Pointer types). All types have an interface;
if they have no methods associated with them, their interface is
called the ``empty'' interface.
Type interfaces
----
The ``static type'' (or simply ``type'') of a variable is the type defined by
the variable's declaration. The ``dynamic type'' of a variable is the actual
type of the value stored in a variable at runtime. Except for variables of
interface type, the dynamic type of a variable is always its static type.
Variables of interface type may hold values with different dynamic types
during execution. However, its dynamic type is always compatible with
the static type of the interface variable (§Interface types).
TODO fill in this section
Basic types
----
...
...
@@ -1182,8 +1180,9 @@ Assignment compatibility: A function pointer can be assigned to a function
Interface types
----
An interface type denotes the set of all types that implement the
set of methods specified by the interface type.
Type interfaces may be specified explicitly by interface types.
An interface type denotes the set of all types that implement at least
the set of methods specified by the interface type, and the value "nil".
InterfaceType = "interface" "{" [ MethodList [ ";" ] ] "}" .
MethodList = MethodSpec { ";" MethodSpec } .
...
...
@@ -2280,9 +2279,9 @@ A method declaration is a function declaration with a receiver. The receiver
is the first parameter of the method, and the receiver type must be specified
as a type name, or as a pointer to a type name. The type specified by the
type name is called ``receiver base type''. The receiver base type must be a
type declared in the current file
. The method is said to be ``bound'' to
the receiver base type; specifically it is declared within the scope of
that type (§Type interfac
es).
type declared in the current file
, and it must not be a pointer type.
The method is said to be ``bound'' to the receiver base type; specifically
it is declared within the scope of that type (§Typ
es).
MethodDecl = "func" Receiver identifier FunctionType ( ";" | Block ) .
Receiver = "(" identifier [ "*" ] TypeName ")" .
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment