[Swift-commit] r3920 - text/parco10submission
noreply at svn.ci.uchicago.edu
noreply at svn.ci.uchicago.edu
Sat Jan 8 19:32:33 CST 2011
Author: foster
Date: 2011-01-08 19:32:32 -0600 (Sat, 08 Jan 2011)
New Revision: 3920
Modified:
text/parco10submission/paper.tex
Log:
Various minor edits
Modified: text/parco10submission/paper.tex
===================================================================
--- text/parco10submission/paper.tex 2011-01-09 01:00:37 UTC (rev 3919)
+++ text/parco10submission/paper.tex 2011-01-09 01:32:32 UTC (rev 3920)
@@ -370,10 +370,10 @@
The outermost function in a Swift (akin to ``main'' in C) is only unique in that the variables in its environment
can be declared ``global'' to make them accessible to every other function in the script.
-Each variable in a Swift script is declared to be of a specific (single) type. The Swift type model is simple, with no concepts of inheritance, abstraction, etc.
+Each variable in a Swift script is declared to be of a specific type. The Swift type model is simple, with no concepts of inheritance or abstraction.
There are three basic classes of data types: primitive, mapped, and collection.
-The four \emph{primitive types} are integer, float, string, and boolean values. Common operators are defined for
+The four primary \emph{primitive types} are integer, float, string, and boolean values. Common operators are defined for
primitive types, such as arithmetic, concatenation, and explicit conversion.
(An additional primitive type ``external'' is provided for manual synchronization; we do not discuss this feature here.)
@@ -384,36 +384,10 @@
There are no built-in mapped types in the language. Instead, users declare type names with no other structure to denote
any mapped type names desired. For example: {\tt type file; type log;}
-The two \emph{collection types} are \emph{arrays}, with elements accessed via an index, and \emph{structures}, with elements accessed via a "." operator.
-Arrays contain values of only a single type; structure fields can be of any type.
-Both types of collections can contain members of primitive, mapped, or collection types;
-in particular, arrays can be nested to provide multi-dimensional indexing.
-Structures contain a declared number of elements. The number of elements in an array can be determined at run time.
-
-The size of a Swift array is not declared in the program but is determined at run time, as items are added to the array.
-This feature proves useful for expressing some common classes of parallel computations. For example, we may
-create an array containing just those experimental configurations that satisfy a certain criteria.
-An array is considered ``closed'' when no further statements that set an element of the array can be executed.
-This state is recognized at run time by information obtained from compile-time analysis of the script's call graph.
-%IAN: This last paragraph raises the issue of whether this state can always be determiend.
-The set of elements that is thus defined need not be contiguous; i.e., the index set may be sparse.
-As we will see below, the {\tt foreach}
-statement makes it easy to access all elements of an array.
-
-%New types can be declared to define a new mapped type or to name a structure type. The type model is by design very simple and limited to keep type semantics easy to understand, implement and use.
-
-%Due to the dynamic, parallel nature of Swift, its arrays have no notion of size. Array elements can be set as a script's execution progresses. The number of elements set increases monotonically. An array is considered ``closed'' when no further statements that set an element of the array can be executed. This state is recognized at run time by information obtained from compile-time analysis of the script's call graph.
-%IAN: This last paragraph raises the issue of whether this state can always be determiend.
-
-%Also, since all data elements have single-assignment semantics, no garbage collection issues arise. \katznote{does this follow? garbage collection removed variables that are no longer needed - I don't see how single assignment helps here.}
-%\mihaelnote{I think we should not mention the garbage collection issue. In fact, we don't and we should implement
-%garbage collection at the "dual" level (i.e., clean temp files) as well as remove unused futures from memory}
-% Mike: I mentioned GC as it pertains to structures and arrays: since swift is single-assignment, structures and arrays can never get de-referenced and thus dont need to be GC'ed - *I think*. But I can see that internal objects like futures should be, and given that they dont, its best to steer clear of this issue for now.
-
A variable that is declared to be a mapped file
%IAN: Explain what we mean by dynamic lookup? Do we mean e.g accessing a directory to see what files it contains?
is associated with a \emph{mapper}, which defines (often through a dynamic lookup process) the
-file that is mapped to the variable. Array and structure elements that are declared to be mapped files are similarly mapped.
+file that is mapped to the variable.
Mapped type and collection
type variable declarations can be annotated with a
@@ -436,22 +410,13 @@
The notation \verb|{}| indicates that the type represents a reference to a single \emph{opaque}
file, i.e., a reference to an external object whose structure is opaque to the Swift script.
-For convenience such type declarations typically use the equivalent shorthand \verb|type image;|
-(this compact notation is confusing at first but has become a useful Swift idiom).
+For convenience such type declarations typically use the equivalent shorthand \verb|type image;|.
+(This compact notation can be confusing at first but has become a useful Swift idiom.)
-Mapped type variable declarations can be specified with a
-\emph{mapping} descriptor enclosed in \verb|<>| that indicates the file to be mapped to the variable.
-For example, the following line declares a variable named \verb|photo| of
-type \verb|image|. Since image is a mapped file type, it additionally declares that the
-variable refers to a single file named \verb|puppy.jpeg|:
+The two \emph{collection types} are structures and arrays.
+A \emph{structure type} lists the set of elements contained in the structure, as for example in the following definition of the structure type \verb|snapshot|:
\begin{verbatim}
- image photo <"puppy.jpeg">;
-\end{verbatim}
-
-\emph{Structure types} are defined in this manner:
-
-\begin{verbatim}
type image;
type metadata;
type snapshot {
@@ -460,6 +425,11 @@
}
\end{verbatim}
+Structure fields can be of any type.
+Both types of collections can contain members of primitive, mapped, or collection types;
+in particular, arrays can be nested to provide multi-dimensional indexing.
+
+
Members of a structure can be accessed using the \verb|.| operator:
\begin{verbatim}
@@ -468,8 +438,33 @@
im = sn.i;
\end{verbatim}
-%\katznote{please check the above - I changed a couple of variables so ``i'' wasn't used twice for different things in the same example.}
+An array type
+Arrays contain values of only a single type; structure fields can be of any type.
+Both types of collections can contain members of primitive, mapped, or collection types;
+in particular, arrays can be nested to provide multi-dimensional indexing.
+
+
+The size of a Swift array is not declared in the program but is determined at run time, as items are added to the array.
+This feature proves useful for expressing some common classes of parallel computations. For example, we may
+create an array containing just those experimental configurations that satisfy a certain criteria.
+An array is considered ``closed'' when no further statements that set an element of the array can be executed.
+This state is recognized at run time by information obtained from compile-time analysis of the script's call graph.
+%IAN: This last paragraph raises the issue of whether this state can always be determiend.
+The set of elements that is thus defined need not be contiguous; i.e., the index set may be sparse.
+As we will see below, the {\tt foreach}
+statement makes it easy to access all elements of an array.
+
+%New types can be declared to define a new mapped type or to name a structure type. The type model is by design very simple and limited to keep type semantics easy to understand, implement and use.
+
+%Due to the dynamic, parallel nature of Swift, its arrays have no notion of size. Array elements can be set as a script's execution progresses. The number of elements set increases monotonically. An array is considered ``closed'' when no further statements that set an element of the array can be executed. This state is recognized at run time by information obtained from compile-time analysis of the script's call graph.
+%IAN: This last paragraph raises the issue of whether this state can always be determiend.
+
+%Also, since all data elements have single-assignment semantics, no garbage collection issues arise. \katznote{does this follow? garbage collection removed variables that are no longer needed - I don't see how single assignment helps here.}
+%\mihaelnote{I think we should not mention the garbage collection issue. In fact, we don't and we should implement
+%garbage collection at the "dual" level (i.e., clean temp files) as well as remove unused futures from memory}
+% Mike: I mentioned GC as it pertains to structures and arrays: since swift is single-assignment, structures and arrays can never get de-referenced and thus dont need to be GC'ed - *I think*. But I can see that internal objects like futures should be, and given that they dont, its best to steer clear of this issue for now.
+
\subsection{Built-in, application interface, and compound functions}
Swift's \emph{built-in functions} are implemented by the Swift runtime system, and perform various utility functions (numeric conversion, string manipulation, etc.). Built-in operators (+, *, etc.) behave similarly.
More information about the Swift-commit
mailing list