[Swift-commit] r3867 - text/parco10submission
noreply at svn.ci.uchicago.edu
noreply at svn.ci.uchicago.edu
Wed Jan 5 19:10:54 CST 2011
Author: wilde
Date: 2011-01-05 19:10:54 -0600 (Wed, 05 Jan 2011)
New Revision: 3867
Modified:
text/parco10submission/paper.tex
Log:
edits to initial subsections of Language section.
Modified: text/parco10submission/paper.tex
===================================================================
--- text/parco10submission/paper.tex 2011-01-06 00:12:04 UTC (rev 3866)
+++ text/parco10submission/paper.tex 2011-01-06 01:10:54 UTC (rev 3867)
@@ -340,11 +340,19 @@
types, operators, and built-in functions.
Its simple, uniform data model is composed of a few atomic types (which can be simple scalar values or references to external files) and two collection types (arrays and structures).
-Swift expresses the
-invocation of ``ordinary programs''---technically, POSIX {\tt exec()}
-operations---in a manner that explicitly specifies the files and command-line
+A Swift script describes data, application components, invocations
+of applications components, and the inter-relations (data flow)
+between those invocations, using a C-like syntax.
+Swift scripts are written as a set of functions, composed upwards,
+starting with \emph{atomic functions} that specify the execution of
+external programs, and then higher level functions are composed as
+pipelines (or more generally, graphs) of sub-functions.
+
+Unlike most other scripting languages, Swift expresses
+invocations of ``ordinary programs''---technically, POSIX {\tt exec()}
+operations---in a manner that explicitly declares the files and command-line
arguments that are the inputs of each program
-invocation. It similarly expresses all output files that results from the programs.
+invocation. Swift scripts similarly declare all output files that results from program invocations.
This enables Swift to provide distributed, location-independent execution of external application programs.
The Swift parallel execution model is based on two concepts that are applied uniformly throughout the language. First, every Swift data element behaves like a \emph{future}. By ``data element'', we mean both the named variables within a function's environment, such as its local variables, parameters, and returns, and the individual elements of array and structure collections. Second, every expression in a Swift program is conceptually executed in parallel. Expressions (including function evaluations) wait for input values when they are required, and then set their result values as their computation proceeds. These fundamental concepts are discussed in more detail below.
@@ -384,32 +392,36 @@
data. Consequently Swift must and does implement nominal type equivalence.}
\emph{Collection types} are provided in Swift by \emph{arrays} and \emph{structures}.
-Structure fields can be of any type, while arrays contain only uniform values of a single type. Both types of collections can contain members of atomic or collection types. Structures contain a finite number of elements. Arrays contain a varying number of elements. Structures and arrays can both recursively contain each other in addition to atomic values.
+Structure fields can be of any type, while arrays contain only uniform values of a single type. Both types of collections can contain members of atomic or collection types. Structures contain a finite number of elements. Arrays contain a varying number of elements. Structures and arrays can both recursively reference other structures and arrays in addition to atomic values.
-Due to the dynamic nature of the execution model, Swift arrays have no notion of size. 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.
+Due to the dynamic, highly 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. Also, since all data elements have single-assignment semantics, no garbage collection issues arise.
-\subsection{Functions - Mihael}
+\subsection{Execution model}
-At the core of the Swift language are function definitions, of which
-two types exist:
-\begin{description}
-\item[External functions] (also called ``atomic'') are functions whose
+Swift has three types of functions:
+
+\emph{Built-in functions} are defined in the Java code of the Swift runtime system, and perform various utility functions.
+
+\emph{Atomic functions}are functions whose
implementations are not written in Swift. Currently external functions
-are implemented as command-line applications.
-\item[Internal functions] (also called ``compound'') are functions
-implemented in Swift.
-\end{description}
+are implemented as command-line applications or built-in functions defined in Java.
-In addition to functions, the Swift language provides conditional
+Application wrapper functions (declared using the app keyword)
+specify the interface (input files and parameters, and output files) of application programs in
+terms of files and other parameters.
+
+\emph{Compound functions} are functions
+that call atomic and other compound
+functions.
+
+In addition to function invocation, the Swift language provides conditional
execution through the \emph{if} and \emph{switch} statements as well as
a \emph{foreach} construct used for iterating over arrays of data.
-%%%
-\hide{{\color{red} Note: I'm skipping \emph{iterate} on purpose. We should
+\hide{Mihael: Note: I'm skipping \emph{iterate} on purpose. We should
deprecate it since it's hard to understand and everything that can be
-done with it can also be done with \emph{foreach}}
+done with it can also be done with \emph{foreach}
}
-%%%
The \emph{if} and \emph{switch} statements are rather standard, but
\emph{foreach} merits more discussion. Similar to \emph{Go}
@@ -426,21 +438,6 @@
(i.e., variables are single-assignment), therefore one would not be able
to write statements such as \verb|i = i + 1|.
-
-\subsection{Language basics}
-
-A Swift script describes data, application components, invocations
-of applications components, and the inter-relations (data flow)
-between those invocations, using a C-like syntax.
-Swift scripts are written as a set of functions, composed upwards,
-starting with \emph{atomic functions} that specify the execution of
-external programs, and then higher level functions are composed as
-pipelines (or more generally, graphs) of sub-functions. Atomic
-functions specify the inputs and outputs of application programs in
-terms of files and other parameters. Compound functions are composed
-into a conceptual graph of calls to atomic and other compound
-functions.
-
Swift variables hold either primitive values, files, or collections of
files. All variables are \emph{single-assignment} (meaning
that they must be assigned to exactly one value during execution),
@@ -478,13 +475,17 @@
are similar in most respects to structure types in other languages.
One
array type is provided for every atomic type (integer, string, boolean, and fileRef).
+%%% ^^^ fileref, type issues.
Arrays use numeric
indices, but are sparse. Arrays can be nested to provide multi-dimensional indexing.
We often refer to instances of composites of
mapped types as \emph{datasets}.
+
%\katznote{maybe a little figure here?}
+\subsection{Mapping files to data elements}
+
Mapped type and composite type variable declarations can be annotated with a
\emph{mapping} descriptor that indicates the file(s) that make(s) up that \emph{dataset}.
For example, the following line declares a variable named \verb|photo| of
More information about the Swift-commit
mailing list