[Swift-user] Re: a third tutorial question

Mihael Hategan hategan at mcs.anl.gov
Thu Oct 14 14:40:33 CDT 2010


On Thu, 2010-10-14 at 12:18 -0500, Daniel S. Katz wrote:
> But both seem to work...
> 
> Which is the favored choice, and why? The example in first.swift seems shorter and cleaner...

Originally it was:

(returns) name(params) { app {...}}

That made little sense.

So it was changed to:

app (returns) name(params) {...}

which more closely matches the modifier idea in C/Java and the likes.

At the same time, the former was deprecated (except there probably is no
mention of this anywhere). It should, IMO, be removed in future versions
of swift.

So what you consider cleaner is what I would stick with.

Mihael

> 
> Dan
> 
> 
> On Oct 14, 2010, at 12:15 PM, Allan Espinosa wrote:
> 
> > This was a change in the API around a year or two ago.   Clearly the
> > documentation needs an update.
> > 
> > -Allan
> > 
> > 2010/10/14 Daniel S. Katz <dsk at ci.uchicago.edu>:
> >> One more Swift thing I don't understand...
> >> Dan
> >> 
> >> 
> >> Begin forwarded message:
> >> 
> >> From: "Daniel S. Katz" <dsk at ci.uchicago.edu>
> >> Date: October 14, 2010 10:45:24 AM CDT
> >> To: swift-user at ci.uchicago.edu
> >> Subject: a third tutorial question
> >> 
> >> In http://www.ci.uchicago.edu/swift/guides/tutorial.php in first.swift, the
> >> procedure is defined as:
> >> 
> >> app (messagefile t) greeting () {
> >>         echo "Hello, world!" stdout=@filename(t);
> >> }
> >> 
> >> 
> >> in parameter.swift, the new procedure is defined as:
> >> 
> >> (messagefile t) greeting (string s) {
> >>     app {
> >>         echo s stdout=@filename(t);
> >>     }
> >> }
> >> 
> >> I don't understand why the style of defining the procedure has changed, or
> >> what this change implies.
> >> I would have just started with the first.swift procedure, and changed it to:
> >> 
> >> app (messagefile t) greeting (string s) {
> >>         echo s stdout=@filename(t);
> >> }
> >> 
> >> 
> >> In fact, I did try this, and the code works fine, so I fail to understand
> >> the reason for the larger change that is in the tutorial.
> >> 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/
> >> 
> >> 
> >> 
> >> 
> >> --
> >> 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/
> >> 
> >> 
> >> 
> >> 
> > 
> > 
> > 
> > -- 
> > Allan M. Espinosa <http://amespinosa.wordpress.com>
> > PhD student, Computer Science
> > University of Chicago <http://people.cs.uchicago.edu/~aespinosa>
> 





More information about the Swift-user mailing list