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
bb059426
Commit
bb059426
authored
Aug 20, 2008
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated section on reserved words
R=r DELTA=44 (27 added, 2 deleted, 15 changed) OCL=14353 CL=14355
parent
3308eb44
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
16 deletions
+41
-16
go_lang.txt
doc/go_lang.txt
+41
-16
No files found.
doc/go_lang.txt
View file @
bb059426
...
@@ -4,7 +4,7 @@ The Go Programming Language (DRAFT)
...
@@ -4,7 +4,7 @@ The Go Programming Language (DRAFT)
Robert Griesemer, Rob Pike, Ken Thompson
Robert Griesemer, Rob Pike, Ken Thompson
----
----
(August
12
, 2008)
(August
20
, 2008)
This document is a semi-formal specification/proposal for a new
This document is a semi-formal specification/proposal for a new
systems programming language. The document is under active
systems programming language. The document is under active
...
@@ -309,21 +309,44 @@ type, a function, etc.
...
@@ -309,21 +309,44 @@ type, a function, etc.
ThisIsVariable9
ThisIsVariable9
αβ
αβ
The following identifiers are predeclared:
- all basic types:
bool, uint8, uint16, uint32, uint64, int8, int16, int32, int64,
float32, float64, float80, string
- and their alias types:
byte, ushort, uint, ulong, short, int, long, float, double, ptrint
- the predeclared constants
true, false, nil
- the predeclared functions (note: this list is likely to change)
convert(), len(), new(), panic(), print(), ...
TODO(gri) We should think hard about reducing the alias type list to:
byte, uint, int, float, ptrint (note that for instance the C++ style
guide is explicit about not using short, long, etc. because their sizes
are unknown in general).
Reserved words
Reserved words
----
----
break fallthrough interface return
The following words are reserved and must not be used as identifiers:
case false iota select
const for map struct
chan func new switch
continue go nil true
default goto package type
else if range var
export import
With the exception of structure fields and methods, reserved words may
break export import select
not be declared as identifiers.
case fallthrough interface struct
const for iota switch
chan func map type
continue go package var
default goto range
else if return
Types
Types
...
@@ -385,7 +408,7 @@ Other basic types include:
...
@@ -385,7 +408,7 @@ Other basic types include:
string immutable strings of bytes
string immutable strings of bytes
any polymorphic type
any polymorphic type
Two
reserved word
s, ``true'' and ``false'', represent the
Two
predeclared constant
s, ``true'' and ``false'', represent the
corresponding boolean constant values.
corresponding boolean constant values.
Strings are described in a later section.
Strings are described in a later section.
...
@@ -1389,8 +1412,10 @@ Examples of general expressions
...
@@ -1389,8 +1412,10 @@ Examples of general expressions
The nil value
The nil value
----
----
The reserved word
The predeclared constant
nil
nil
represents the ``zero'' value for a pointer type or interface type.
represents the ``zero'' value for a pointer type or interface type.
The only operations allowed for nil are to assign it to a pointer or
The only operations allowed for nil are to assign it to a pointer or
...
@@ -1605,11 +1630,11 @@ elements.
...
@@ -1605,11 +1630,11 @@ elements.
The constant generator 'iota'
The constant generator 'iota'
----
----
Within a declaration, the reserved word
'iota'
represents successive
Within a declaration, the reserved word
"iota"
represents successive
elements of an integer sequence.
elements of an integer sequence.
It is reset to zero whenever the reserved word
'const'
It is reset to zero whenever the reserved word
"const"
introduces a new declaration and increments as each identifier
introduces a new declaration and increments as each identifier
is declared. For instance,
'iota'
can be used to construct
is declared. For instance,
"iota"
can be used to construct
a set of related constants:
a set of related constants:
const (
const (
...
...
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