From: Robert Griesemer Date: Wed, 31 Jul 2013 21:10:46 +0000 (-0700) Subject: undo CL 11884043 / bfd5ed8236d5 X-Git-Tag: go1.2rc2~861 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=9f75dd7f25d0171bb0b32522de41b252d6eef111;p=gostls13.git undo CL 11884043 / bfd5ed8236d5 CL submitted prematurely by mistake. ««« original CL description spec: clarify index and selector expressions 1) Explain a[i] and a[i:j] where a is of type *A as shortcut for (*a)[i] and (*a)[i:j], respectively. 2) Together with 1), because len() of nil slices is well defined, there's no need to special case nil operands anymore. 3) The result of indexing or slicing a constant string is always a non-constant byte or string value. 4) The result of slicing an untyped string is a value of type string. 5) If the operand of a valid slice a[i:j] is nil (i, j must be 0 for it to be valid - this already follows from the in-range rules), the result is a nil slice. Fixes #4913. Fixes #5951. R=rsc, r, iant, ken CC=golang-dev https://golang.org/cl/11884043 »»» R=r CC=golang-dev https://golang.org/cl/12170046 --- diff --git a/doc/go_spec.html b/doc/go_spec.html index d64a0b0c82..3f6ea8668c 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -1,6 +1,6 @@ @@ -1909,7 +1909,7 @@ ShortVarDecl = IdentifierList ":=" ExpressionList .

-It is shorthand for a regular variable declaration +It is a shorthand for a regular variable declaration with initializer expressions but no types:

@@ -2245,7 +2245,7 @@ element index plus one. A slice literal has the form

-and is shorthand for a slice operation applied to an array: +and is a shortcut for a slice operation applied to an array:

@@ -2462,7 +2462,7 @@ is also a pointer to a struct, x.y.z is shorthand
 for (*(*x).y).z, and so on.
 If x contains an anonymous field of type *A,
 where A is also a struct type,
-x.f is shorthand for (*x.A).f.
+x.f is a shortcut for (*x.A).f.
 

@@ -2519,9 +2519,10 @@ a[x]

-denotes the element of the array, pointer to array, slice, string or map a indexed by x. -The value x is called the index or map key, respectively. -The following rules apply: +denotes the element of the array, slice, string or map a indexed by x. +The value x is called the +index or map key, respectively. The following +rules apply:

@@ -2536,48 +2537,44 @@ If a is not a map:

-For a of array type A: +For a of type A or *A +where A is an array type:

-For a of pointer to array type: -

- - -

-For a of slice type S: +For a of type S where S is a slice type:

-For a of string type: +For a of type T +where T is a string type:

-For a of map type M: +For a of type M +where M is a map type: