Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
aa533738
Commit
aa533738
authored
May 08, 2008
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- changed compound type -> composite type
- eliminated 'structured type' terminology SVN=118200
parent
b6b8da82
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
14 deletions
+15
-14
doc/go_lang.txt
doc/go_lang.txt
+15
-14
No files found.
doc/go_lang.txt
View file @
aa533738
The Go Programming Language
----
(May
5
, 2008)
(May
8
, 2008)
This document is an informal specification/proposal for a new systems programming
language.
...
...
@@ -279,7 +279,7 @@ Types
A type specifies the set of values that variables of that type may
assume, and the operators that are applicable.
There are basic types and compo
und types constructed from them
.
There are basic types and compo
site types
.
Basic types
...
...
@@ -537,11 +537,8 @@ At any given time, a variable or value has exactly one dynamic
type, which may be the same as the static type. (They will
differ only if the variable has an interface type or "any" type.)
Compound types may be constructed from other types by
assembling arrays, maps, channels, structures, and functions.
Array, map and struct types are called structured types, all other types
are called unstructured. A structured type cannot contain itself.
Types may be composed from other types by assembling arrays, maps,
channels, structures, and functions. They are called composite types.
Type = TypeName | ArrayType | ChannelType | InterfaceType |
FunctionType | MapType | StructType | PointerType .
...
...
@@ -554,7 +551,7 @@ Array types
[TODO: this section needs work regarding the precise difference between
static, open and dynamic arrays]
An array is a
structured
type consisting of a number of elements
An array is a
composite
type consisting of a number of elements
all of the same type, called the element type. The number of
elements of an array is called its length. The elements of an array
are designated by indices which are integers between 0 and the length - 1.
...
...
@@ -584,7 +581,7 @@ its length is a constant) using the built-in special function len():
Map types
----
A map is a
structured
type consisting of a variable number of entries
A map is a
composite
type consisting of a variable number of entries
called (key, value) pairs. For a given map,
the keys and values must each be of a specific type.
Upon creation, a map is empty and values may be added and removed
...
...
@@ -935,10 +932,10 @@ A constant declaration gives a name to the value of a constant expression.
Type declarations
----
A type declaration introduces a name as a shorthand for a type.
Providing only
a name without a type serves as a forward declaration: The name is declared and
given an incomplete type. Incomplete types can be used together (and only) with
pointer types.
A type declaration introduces a name as a shorthand for a type.
The name refers
to an incomplete type until the type specification is complete. If no type is
provided at all, the declaration effectively serves as a forward declaration.
Incomplete types can be used together (and only) with
pointer types.
TypeDecl = "type" ( TypeSpec | "(" TypeSpecList [ ";" ] ")" ).
TypeSpec = identifier [ Type ] .
...
...
@@ -952,6 +949,10 @@ pointer types.
Polar Point
)
Since incomplete types can only be used with pointer types, in a type
declaration a type may not refer to itself unless it does so with a
pointer type.
Variable declarations
----
...
...
@@ -1292,7 +1293,7 @@ These conversions are called ``compound conversions''.
There is syntactic help to make conversion expressions simpler to write.
If the result type is of ConversionType (a type name, array type,
map type, struct
ure
type, or interface type, essentially anything
map type, struct type, or interface type, essentially anything
except a pointer), the conversion can be rewritten to look
syntactically like a call to a function whose name is the type:
...
...
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