2. The Swift language
Swift is, by design, a sparse scripting language that executes external programs remotely and in parallel. As such, Swift
has only a limited set of data types, operators, and built-in functions. Its data model comprises a few atomic types (that can
be scalar values or references to external files) and two collection types (arrays and structures).
A Swift script uses a C-like syntax to describe data, application components, invocations of application components, and
the interrelations (data flow) among those invocations. Swift scripts are written as a set of functions, composed upwards,
starting with atomic functions that specify the execution of external programs. Higher-level functions are then composed
as pipelines (or, more generally, graphs) of subfunctions.
Unlike most other scripting languages, Swift expresses invocations of ordinary programs—technically, POSIX exec ()
operations—in a manner that explicitly declares the files and command-line arguments that are the inputs of each program
invocation. Swift scripts similarly declare all output files that result from program invocations. This approach 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 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 collec-tions. Second, all expressions in a Swift program are 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 of pervasive implicit parallelism and transparent location independence, along with the natural manner
in which Swift expresses the processing of files by applications as if they were ‘‘in-memory’’ objects, are the powerful
aspects that make Swift unique among scripting tools. These aspects are elaborated in this section.