This thesis describes the motivation, design, and implementation of L.B. Stanza, an optionally-typed functional programming language aimed at helping programmers tackle the complexity of architecting large programs and increasing their productivity across the entire software development life cycle. Its design objectives arose out of our own frustrations with writing software, and we built Stanza to be a practical general-purpose language that resolves the problems we encounter in our daily work.
Stanza was designed to write programs of appreciable complexity; where development time is spent primarily on managing this complexity; and where better tools for managing complexity can significantly improve programmer productivity. In our experience with writing software, there are five primary activities that occupied the majority of our time: finding and fixing errors, coordinating multiple algorithms, architecting and maintaining a clean software infrastructure, minimizing and maintaining redundancies in code, and optimizing for performance.
Stanza consists of five orthogonal subsystems to address each of the previous issues: the optional type system, the targetable coroutine system, the multimethod object system, the programmatic macro system, and the LoStanza sublanguage. Each subsystem is responsible for a separate facet of software development -- error detection, control flow and concurrency, architecture, syntactic abstraction, and low-level control -- and work in concert to form a small but expressive language.
The optional type system allows programmers to transition freely between the dynamically-typed and statically-typed paradigms, and thus offers both productivity and flexibility in addition to early error detection capabilities. The targetable coroutine system allows for programmers to easily coordinate multiple algorithms, and also acts as a foundational control-flow operator. The multimethod object system is a novel class-less object system that unifies the functional programming with the object-oriented programming styles. The programmatic macro system allows for arbitrary syntactic abstractions in the style of Lisp while still retaining a natural and familiar syntax. Finally, the LoStanza sublanguage provides programmers both direct access to low-level hardware details as well as the ability to easily communicate and interoperate with high-level code.
Stanza has been successfully applied to the development of a number of significant projects at U.C. Berkeley, including the development of a digital hardware design language, a just-in-time-compiled teaching language, as well as a full native-code optimizing compiler. By the later stages of the Stanza project, Stanza's productivity allowed for the optimizing compiler to be developed by a single student over the course of four months.
This thesis describes the language design goals we have identified as being important for the class of programs we write, and how these goals are realized in the design of Stanza and its subsystems. Stanza's design is compared against that of other languages, and we point out the advantages and disadvantages of each. We then explain the overall implementation of the Stanza compiler and runtime system; share our personal experiences with teaching and programming in Stanza; and end with a summary of future work.