<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi,<div><br></div><div>I'm just working through the swift examples in the tutorial (<a href="http://www.ci.uchicago.edu/swift/guides/tutorial.php">http://www.ci.uchicago.edu/swift/guides/tutorial.php</a>). Some thoughts/comments follow...</div><div><br></div><div><br></div><div><img id="48a9e257-b600-403a-bdf6-10427ccd3b74" height="182" width="813" apple-width="yes" apple-height="yes" src="cid:52B3A2D2-A5FB-4BFE-974A-25757A5267E4@uchicago.edu"></div><div><br></div><div>This is confusing to me. If the "file to use" is t, it feels to me that t should be an input parameter, as it tells greeting where to write its output.</div><div><br></div><div>It seems that the following should work:</div><div><br></div><div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">type messagefile;</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;"><br></span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">app () greeting(messagefile t) {</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;"> echo "Hello, world!" stdout=@filename(t);</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">}</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;"><br></span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">messagefile outfile <"hello.txt">;</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;"><br></span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">greeting(outfile );</span></font></div><div><br></div><div><br></div><div>but it doesn't, as it appears procedures require a return value.</div><div><br></div><div>So I next tried the following, which seemed like it should work:</div><div><br></div><div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">type messagefile;</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">int useless;</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;"><br></span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">app (int x) greeting(messagefile t) { </span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;"> echo "Hello, world!" stdout=@filename(t);</span></font></div><div><span class="Apple-style-span" style="font-family: Courier; font-size: 12px; ">}</span></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;"><br></span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">messagefile outfile <"hello.txt">;</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;"><br></span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">useless = greeting(outfile );</span></font></div></div><div><br></div><div><br></div><div>but it also didn't, at least not when hello.txt doesn't already exist. The command and output are:</div><div><br></div><div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">tmp:swift dsk$ swift check.swift </span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">Swift 0.9 swift-r2860 cog-r2388</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;"><br></span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">RunID: 20101014-1003-tq1hn851</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">Progress:</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">Failed to transfer wrapper log from check-20101014-1003-tq1hn851/info/4 on localhost</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">Progress: Stage in:1</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">Failed to transfer wrapper log from check-20101014-1003-tq1hn851/info/6 on localhost</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">Progress: Stage in:1</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">Failed to transfer wrapper log from check-20101014-1003-tq1hn851/info/8 on localhost</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">Execution failed:</span></font></div><div><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;"> </span></font></span><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">Exception in echo:</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">Arguments: [Hello, world!]</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">Host: localhost</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">Directory: check-20101014-1003-tq1hn851/jobs/8/echo-8dycd50k</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">stderr.txt: </span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;"><br></span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">stdout.txt: </span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;"><br></span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">----</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;"><br></span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">Caused by:</span></font></div><div><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;"> </span></font></span><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">File not found: /Users/dsk/Desktop/swift-0.9/examples/swift/./hello.txt</span></font></div></div><div><br></div><div><br></div><div>So, clearly there is something about Swift that I'm missing, and that I'm not gathering from the tutorial web page.</div><div><br></div><div>I'm writing this with two goals - first, to figure out what basic concept I'm missing, and second, to perhaps expand the tutorial web page so that others don't have this issue.</div><div><br></div><div>Thanks.</div><div>Dan</div><div><br></div><div>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; font-size: 9px; "><div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; font-family: 'Lucida Grande'; font-size: 10px; "><div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; font-family: Helvetica; font-size: 12px; "><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; "><font class="Apple-style-span" face="Courier">-- </font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; "><font class="Apple-style-span" face="Courier">Daniel S. Katz</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; "><font class="Apple-style-span" face="Courier">University of Chicago</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; "><font class="Apple-style-span" face="Courier">(773) 834-7186 (voice)</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; "><font class="Apple-style-span" face="Courier">(773) 834-3700 (fax)</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; "><font class="Apple-style-span" face="Courier"><a href="mailto:d.katz@ieee.org">d.katz@ieee.org</a> or <a href="mailto:dsk@ci.uchicago.edu">dsk@ci.uchicago.edu</a></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; min-height: 14px; "><span class="Apple-style-span" style="font-family: Courier; "><a href="http://www.ci.uchicago.edu/~dsk/">http://www.ci.uchicago.edu/~dsk/</a></span></div><div><font class="Apple-style-span" face="Courier"><br></font></div></div></div></div></div></div></div></div><br class="Apple-interchange-newline"><br class="Apple-interchange-newline">
</div>
<br></div></body></html>