Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(444)

Side by Side Diff: doc/go_spec.html

Issue 7100046: code review 7100046: doc/go_spec.html: clarification about insertion during ... (Closed)
Patch Set: diff -r fc9545bf5a1f https://code.google.com/p/go Created 12 years, 2 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!--{ 1 <!--{
2 "Title": "The Go Programming Language Specification", 2 "Title": "The Go Programming Language Specification",
3 » "Subtitle": "Version of January 9, 2013", 3 » "Subtitle": "Version of January 11, 2013",
gri 2013/01/12 22:31:34 up-date
4 "Path": "/ref/spec" 4 "Path": "/ref/spec"
5 }--> 5 }-->
6 6
7 <!-- 7 <!--
8 TODO 8 TODO
9 [ ] need language about function/method calls and parameter passing rules 9 [ ] need language about function/method calls and parameter passing rules
10 [ ] last paragraph of #Assignments (constant promotion) should be elsewhere 10 [ ] last paragraph of #Assignments (constant promotion) should be elsewhere
11 and mention assignment to empty interface. 11 and mention assignment to empty interface.
12 [ ] need to say something about "scope" of selectors? 12 [ ] need to say something about "scope" of selectors?
13 [ ] clarify what a field name is in struct declarations 13 [ ] clarify what a field name is in struct declarations
(...skipping 4361 matching lines...) Expand 10 before | Expand all | Expand 10 after
4375 Function calls on the left are evaluated once per iteration. 4375 Function calls on the left are evaluated once per iteration.
4376 For each iteration, iteration values are produced as follows: 4376 For each iteration, iteration values are produced as follows:
4377 </p> 4377 </p>
4378 4378
4379 <pre class="grammar"> 4379 <pre class="grammar">
4380 Range expression 1st value 2nd value (if 2nd v ariable is present) 4380 Range expression 1st value 2nd value (if 2nd v ariable is present)
4381 4381
4382 array or slice a [n]E, *[n]E, or []E index i int a[i] E 4382 array or slice a [n]E, *[n]E, or []E index i int a[i] E
4383 string s string type index i int see below rune 4383 string s string type index i int see below rune
4384 map m map[K]V key k K m[k] V 4384 map m map[K]V key k K m[k] V
4385 channel c chan E, <-chan E element e E 4385 channel c chan E, &lt;-chan E element e E
4386 </pre> 4386 </pre>
4387 4387
4388 <ol> 4388 <ol>
4389 <li> 4389 <li>
4390 For an array, pointer to array, or slice value <code>a</code>, the index iterati on 4390 For an array, pointer to array, or slice value <code>a</code>, the index iterati on
4391 values are produced in increasing order, starting at element index 0. As a speci al 4391 values are produced in increasing order, starting at element index 0. As a speci al
4392 case, if only the first iteration variable is present, the range loop produces 4392 case, if only the first iteration variable is present, the range loop produces
4393 iteration values from 0 up to <code>len(a)</code> and does not index into the ar ray 4393 iteration values from 0 up to <code>len(a)</code> and does not index into the ar ray
4394 or slice itself. For a <code>nil</code> slice, the number of iterations is 0. 4394 or slice itself. For a <code>nil</code> slice, the number of iterations is 0.
4395 </li> 4395 </li>
4396 4396
4397 <li> 4397 <li>
4398 For a string value, the "range" clause iterates over the Unicode code points 4398 For a string value, the "range" clause iterates over the Unicode code points
4399 in the string starting at byte index 0. On successive iterations, the index val ue will be the 4399 in the string starting at byte index 0. On successive iterations, the index val ue will be the
4400 index of the first byte of successive UTF-8-encoded code points in the string, 4400 index of the first byte of successive UTF-8-encoded code points in the string,
4401 and the second value, of type <code>rune</code>, will be the value of 4401 and the second value, of type <code>rune</code>, will be the value of
4402 the corresponding code point. If the iteration encounters an invalid 4402 the corresponding code point. If the iteration encounters an invalid
4403 UTF-8 sequence, the second value will be <code>0xFFFD</code>, 4403 UTF-8 sequence, the second value will be <code>0xFFFD</code>,
4404 the Unicode replacement character, and the next iteration will advance 4404 the Unicode replacement character, and the next iteration will advance
4405 a single byte in the string. 4405 a single byte in the string.
4406 </li> 4406 </li>
4407 4407
4408 <li> 4408 <li>
4409 The iteration order over maps is not specified 4409 The iteration order over maps is not specified
4410 and is not guaranteed to be the same from one iteration to the next. 4410 and is not guaranteed to be the same from one iteration to the next.
4411 If map entries that have not yet been reached are deleted during iteration, 4411 If map entries that have not yet been reached are removed during iteration,
gri 2013/01/12 22:31:34 I may have missed the prev. discussion but I don't
gri 2013/01/12 22:35:11 Ok. 'remove' is fine.
4412 the corresponding iteration values will not be produced. If map entries are 4412 the corresponding iteration values will not be produced. If map entries are
4413 inserted during iteration, the behavior is implementation-dependent, but the 4413 added during iteration, it is implementation dependent whether they will be
gri 2013/01/12 22:31:34 same: inserted seemed better than 'added'.
gri 2013/01/12 22:35:11 'added' is fine.
4414 iteration values for each entry will be produced at most once. If the map 4414 produced in the iteration. Each newly added entry will be produced not at
gri 2013/01/12 22:31:34 s/./:/
mdempsky 2013/01/13 02:19:19 Is it worth stating somehow that the decision of w
4415 is <code>nil</code>, the number of iterations is 0. 4415 all or exactly once.If the map is <code>nil</code>, the number of iterations
iant 2013/01/12 22:27:31 Two spaces after "once."
4416 is 0.
4416 </li> 4417 </li>
4417 4418
4418 <li> 4419 <li>
4419 For channels, the iteration values produced are the successive values sent on 4420 For channels, the iteration values produced are the successive values sent on
4420 the channel until the channel is <a href="#Close">closed</a>. If the channel 4421 the channel until the channel is <a href="#Close">closed</a>. If the channel
4421 is <code>nil</code>, the range expression blocks forever. 4422 is <code>nil</code>, the range expression blocks forever.
4422 </li> 4423 </li>
4423 </ol> 4424 </ol>
4424 4425
4425 <p> 4426 <p>
(...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after
5672 </li> 5673 </li>
5673 5674
5674 <li>For a variable <code>x</code> of array type: <code>unsafe.Alignof(x)</code> is the same as 5675 <li>For a variable <code>x</code> of array type: <code>unsafe.Alignof(x)</code> is the same as
5675 <code>unsafe.Alignof(x[0])</code>, but at least 1. 5676 <code>unsafe.Alignof(x[0])</code>, but at least 1.
5676 </li> 5677 </li>
5677 </ol> 5678 </ol>
5678 5679
5679 <p> 5680 <p>
5680 A struct or array type has size zero if it contains no fields (or elements, resp ectively) that have a size greater than zero. Two distinct zero-size variables m ay have the same address in memory. 5681 A struct or array type has size zero if it contains no fields (or elements, resp ectively) that have a size greater than zero. Two distinct zero-size variables m ay have the same address in memory.
5681 </p> 5682 </p>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b