[Swift-user] swift understanding/tutorial
Daniel S. Katz
dsk at ci.uchicago.edu
Thu Oct 14 10:19:01 CDT 2010
Hi,
I'm just working through the swift examples in the tutorial (http://www.ci.uchicago.edu/swift/guides/tutorial.php). Some thoughts/comments follow...
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.
It seems that the following should work:
type messagefile;
app () greeting(messagefile t) {
echo "Hello, world!" stdout=@filename(t);
}
messagefile outfile <"hello.txt">;
greeting(outfile );
but it doesn't, as it appears procedures require a return value.
So I next tried the following, which seemed like it should work:
type messagefile;
int useless;
app (int x) greeting(messagefile t) {
echo "Hello, world!" stdout=@filename(t);
}
messagefile outfile <"hello.txt">;
useless = greeting(outfile );
but it also didn't, at least not when hello.txt doesn't already exist. The command and output are:
tmp:swift dsk$ swift check.swift
Swift 0.9 swift-r2860 cog-r2388
RunID: 20101014-1003-tq1hn851
Progress:
Failed to transfer wrapper log from check-20101014-1003-tq1hn851/info/4 on localhost
Progress: Stage in:1
Failed to transfer wrapper log from check-20101014-1003-tq1hn851/info/6 on localhost
Progress: Stage in:1
Failed to transfer wrapper log from check-20101014-1003-tq1hn851/info/8 on localhost
Execution failed:
Exception in echo:
Arguments: [Hello, world!]
Host: localhost
Directory: check-20101014-1003-tq1hn851/jobs/8/echo-8dycd50k
stderr.txt:
stdout.txt:
----
Caused by:
File not found: /Users/dsk/Desktop/swift-0.9/examples/swift/./hello.txt
So, clearly there is something about Swift that I'm missing, and that I'm not gathering from the tutorial web page.
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.
Thanks.
Dan
--
Daniel S. Katz
University of Chicago
(773) 834-7186 (voice)
(773) 834-3700 (fax)
d.katz at ieee.org or dsk at ci.uchicago.edu
http://www.ci.uchicago.edu/~dsk/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/swift-user/attachments/20101014/b419661f/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen shot 2010-10-14 at 9.51.27 AM.png
Type: image/png
Size: 29588 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/swift-user/attachments/20101014/b419661f/attachment.png>
More information about the Swift-user
mailing list