<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Reading a recent email about "iterate" got me looking at the Swift manual. This is looking very nice. I had a couple of comments:<div><br></div><div>1) "<span class="Apple-style-span" style="color: rgb(51, 51, 51); font-family: Verdana; line-height: 17px; ">Conceptually, a parallel can be drawn between Swift mapped variables and Java reference types. In both cases there is no syntactic distinction between primitive types and mapped types or reference types respectively. Additionally, the semantic distinction is also kept to a minimum."</span></div><div><font class="Apple-style-span" color="#333333" face="Verdana"><span class="Apple-style-span" style="line-height: 17px;"><br></span></font></div><div><font class="Apple-style-span" color="#333333" face="Verdana"><span class="Apple-style-span" style="line-height: 17px;">--> I don't think we should assume that readers know what a Java reference type is. Most will not.</span></font></div><div><font class="Apple-style-span" color="#333333" face="Verdana"><span class="Apple-style-span" style="line-height: 17px;"><br></span></font></div><div><font class="Apple-style-span" color="#333333" face="Verdana"><span class="Apple-style-span" style="line-height: 17px;">2) Arrays: I gather from below that the size of an array is defined by assignments to it. This seems confusing and dangerous to me: doesn't it require a global analysis, which must ultimately be undecidable, to determine whether an array is closed?</span></font></div><div><font class="Apple-style-span" color="#333333" face="Verdana"><span class="Apple-style-span" style="line-height: 17px;"><br></span></font></div><div><font class="Apple-style-span" color="#333333" face="Verdana"><span class="Apple-style-span" style="line-height: 17px;"><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-size: 10px; line-height: normal; "><p style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 17px; color: rgb(51, 51, 51); padding-top: 5px; padding-right: 30px; padding-bottom: 0px; padding-left: 30px; margin-top: 0px; margin-right: 0px; margin-bottom: 8px; margin-left: 0px; ">Statements which deal with the array as a whole will often wait for the array to be closed before executing (thus, a closed array is the equivalent of a non-array type being assigned). However, a <code class="literal">foreach</code> statement will apply its body to elements of an array as they become known. It will not wait until the array is closed.</p><p style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 17px; color: rgb(51, 51, 51); padding-top: 5px; padding-right: 30px; padding-bottom: 0px; padding-left: 30px; margin-top: 0px; margin-right: 0px; margin-bottom: 8px; margin-left: 0px; ">Consider this script:</p><div class="dp-highlighter" style="background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: rgb(252, 250, 250); border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; white-space: normal; margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; background-position: initial initial; "><p class="dp-vdl2" style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 17px; color: rgb(51, 51, 51); padding-top: 5px; padding-right: 30px; padding-bottom: 0px; padding-left: 30px; margin-top: 0px; margin-right: 0px; margin-bottom: 8px; margin-left: 0px; "><span class="codeline" style="font-family: Consolas, 'Andale Mono', monospaced; "><span style="font-family: Consolas, 'Andale Mono', monospaced; ">file a[]; <br style="font-family: Consolas, 'Andale Mono', monospaced; "></span></span><span class="codeline" style="font-family: Consolas, 'Andale Mono', monospaced; ">file b[]; <br style="font-family: Consolas, 'Andale Mono', monospaced; "></span><span class="codeline" style="font-family: Consolas, 'Andale Mono', monospaced; "><span class="keyword" style="font-family: Consolas, 'Andale Mono', monospaced; color: rgb(32, 32, 128); font-weight: bold; ">foreach</span><span style="font-family: Consolas, 'Andale Mono', monospaced; "> v,i </span><span class="keyword" style="font-family: Consolas, 'Andale Mono', monospaced; color: rgb(32, 32, 128); font-weight: bold; ">in</span><span style="font-family: Consolas, 'Andale Mono', monospaced; "> a { <br style="font-family: Consolas, 'Andale Mono', monospaced; "></span></span><span class="codeline" style="font-family: Consolas, 'Andale Mono', monospaced; "> b[i] = p(v); <br style="font-family: Consolas, 'Andale Mono', monospaced; "></span><span class="codeline" style="font-family: Consolas, 'Andale Mono', monospaced; ">} <br style="font-family: Consolas, 'Andale Mono', monospaced; "></span><span class="codeline" style="font-family: Consolas, 'Andale Mono', monospaced; ">a[<span class="number" style="font-family: Consolas, 'Andale Mono', monospaced; ">0</span><span style="font-family: Consolas, 'Andale Mono', monospaced; ">] = r(); <br style="font-family: Consolas, 'Andale Mono', monospaced; "></span></span><span class="codeline" style="font-family: Consolas, 'Andale Mono', monospaced; ">a[<span class="number" style="font-family: Consolas, 'Andale Mono', monospaced; ">1</span><span style="font-family: Consolas, 'Andale Mono', monospaced; ">] = s(); <br style="font-family: Consolas, 'Andale Mono', monospaced; "></span></span></p></div><p style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 17px; color: rgb(51, 51, 51); padding-top: 5px; padding-right: 30px; padding-bottom: 0px; padding-left: 30px; margin-top: 0px; margin-right: 0px; margin-bottom: 8px; margin-left: 0px; ">Initially, the <code class="literal">foreach</code> statement will have nothing to execute, as the array <code class="literal">a</code> has not been assigned any values. The procedures <code class="literal">r</code> and <code class="literal">s</code> will execute. As soon as either of them is finished, the corresponding invocation of procedure <code class="literal">p</code> will occur. After both <code class="literal">r</code> and <code class="literal">s</code> have completed, the array <code class="literal">a</code> will be closed since no other statements in the script make an assignment to<code class="literal">a</code>.</p><p style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 17px; color: rgb(51, 51, 51); padding-top: 5px; padding-right: 30px; padding-bottom: 0px; padding-left: 30px; margin-top: 0px; margin-right: 0px; margin-bottom: 8px; margin-left: 0px; "><br></p><p style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 17px; color: rgb(51, 51, 51); padding-top: 5px; padding-right: 30px; padding-bottom: 0px; padding-left: 30px; margin-top: 0px; margin-right: 0px; margin-bottom: 8px; margin-left: 0px; ">3) In the following text, the (,index) is presumably meant to indicate an optional element. But as you don't use a different font, or indeed have indicated what conventions you are using, readers may not realize that.</p><p style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 17px; color: rgb(51, 51, 51); padding-top: 5px; padding-right: 30px; padding-bottom: 0px; padding-left: 30px; margin-top: 0px; margin-right: 0px; margin-bottom: 8px; margin-left: 0px; "><br></p><p style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 17px; color: rgb(51, 51, 51); padding-top: 5px; padding-right: 30px; padding-bottom: 0px; padding-left: 30px; margin-top: 0px; margin-right: 0px; margin-bottom: 8px; margin-left: 0px; "><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-size: 10px; line-height: normal; "><p style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 17px; color: rgb(51, 51, 51); padding-top: 5px; padding-right: 30px; padding-bottom: 0px; padding-left: 30px; margin-top: 0px; margin-right: 0px; margin-bottom: 8px; margin-left: 0px; "><code class="literal">foreach</code> statements have the general form:</p><div class="dp-highlighter" style="background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: rgb(252, 250, 250); border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; white-space: normal; margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; position: static; z-index: auto; "><p class="dp-vdl2" style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 17px; color: rgb(51, 51, 51); padding-top: 5px; padding-right: 30px; padding-bottom: 0px; padding-left: 30px; margin-top: 0px; margin-right: 0px; margin-bottom: 8px; margin-left: 0px; "><span class="codeline" style="font-family: Consolas, 'Andale Mono', monospaced; "><span class="keyword" style="font-family: Consolas, 'Andale Mono', monospaced; color: rgb(32, 32, 128); font-weight: bold; ">foreach</span><span style="font-family: Consolas, 'Andale Mono', monospaced; "> controlvariable (,index) </span><span class="keyword" style="font-family: Consolas, 'Andale Mono', monospaced; color: rgb(32, 32, 128); font-weight: bold; ">in</span><span style="font-family: Consolas, 'Andale Mono', monospaced; "> expression { <br style="font-family: Consolas, 'Andale Mono', monospaced; "></span></span><span class="codeline" style="font-family: Consolas, 'Andale Mono', monospaced; "> statements <br style="font-family: Consolas, 'Andale Mono', monospaced; "></span><span class="codeline" style="font-family: Consolas, 'Andale Mono', monospaced; ">} </span></p></div></span></p></span></span></font></div></body></html>