summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2008-08-11 18:09:31 -0700
committerRobert Griesemer <gri@golang.org>2008-08-11 18:09:31 -0700
commitfe582137f4e9efe5b33ac23ebf0a9e03f4d9bb0b (patch)
tree696198d579af46e75ed22fead17af6ebc94178e8
parent968701beb1562c3492d06e39bf137ee9796e7f57 (diff)
downloadgo-git-fe582137f4e9efe5b33ac23ebf0a9e03f4d9bb0b.tar.gz
- removed fall-through for case: case: in switch statements
- added ()'s to all print calls in examples - augmented rule about use of identifiers R=r DELTA=11 (0 added, 1 deleted, 10 changed) OCL=14097 CL=14097
-rw-r--r--doc/go_lang.txt19
1 files changed, 9 insertions, 10 deletions
diff --git a/doc/go_lang.txt b/doc/go_lang.txt
index ecd3edd971..e3d86ad4e5 100644
--- a/doc/go_lang.txt
+++ b/doc/go_lang.txt
@@ -4,7 +4,7 @@ The Go Programming Language (DRAFT)
Robert Griesemer, Rob Pike, Ken Thompson
----
-(August 7, 2008)
+(August 11, 2008)
This document is a semi-formal specification/proposal for a new
systems programming language. The document is under active
@@ -321,8 +321,8 @@ Reserved words
else if range var
export import
-
-TODO: "len" is currently also a reserved word - it shouldn't be.
+With the exception of structure fields and methods, reserved words may
+not be declared as identifiers.
Types
@@ -1357,9 +1357,9 @@ pointer or interface value.
var p *int;
if p != nil {
- print p
+ print(p)
} else {
- print "p points nowhere"
+ print("p points nowhere")
}
By default, pointers are initialized to nil.
@@ -1735,9 +1735,9 @@ The value of the boolean reports true if the communication succeeded,
false if it did not. These two examples are equivalent:
ok := ch -< 3;
- if ok { print "sent" } else { print "not sent" }
+ if ok { print("sent") } else { print("not sent") }
- if ch -< 3 { print "sent" } else { print "not sent" }
+ if ch -< 3 { print("sent") } else { print("not sent") }
In other words, if the program tests the value of a send operation,
the send is non-blocking and the value of the expression is the
@@ -1753,7 +1753,7 @@ As with send operations, in expression context this form may
be used as a boolean and makes the receive non-blocking:
ok := e <- ch;
- if ok { print "received", e } else { print "did not receive" }
+ if ok { print("received", e) } else { print("did not receive") }
The receive operator may also be used as a prefix unary operator
on a channel.
@@ -1873,8 +1873,7 @@ Switch statements
Switches provide multi-way execution.
SwitchStat = "switch" [ [ Simplestat ] ";" ] [ Expression ] "{" { CaseClause } "}" .
- CaseClause = CaseList [ StatementList [ ";" ] ] [ "fallthrough" [ ";" ] ] .
- CaseList = Case { Case } .
+ CaseClause = Case [ StatementList [ ";" ] ] [ "fallthrough" [ ";" ] ] .
Case = ( "case" ExpressionList | "default" ) ":" .
There can be at most one default case in a switch statement.