Date: Mon, 02 Dec 1996 15:53:22 GMT Server: NCSA/1.4.2 Content-type: text/html Cecil Language Reference Manual [Next]



The Cecil Language


Specification and Rationale

Version 2.0

Craig Chambers

Department of Computer Science and Engineering
University of Washington
Box 352350, Seattle, Washington 98195-2350 USA

September 12, 1996

Abstract

Cecil is a purely object-oriented language intended to support rapid construction of high-quality, extensible software. Cecil combines multi-methods with a simple classless object model, a kind of dynamic inheritance, modules, and optional static type checking. Instance variables in Cecil are accessed solely through messages, allowing instance variables to be replaced or overridden by methods and vice versa. Cecil's predicate objects mechanism allows an object to be classified automatically based on its run-time (mutable) state. Cecil's static type system distinguishes between subtyping and code inheritance, but Cecil enables these two graphs to be described with a single set of declarations, streamlining the common case where the two graphs are parallel. Cecil includes a fairly flexible form of parameterization, including explicitly parameterized objects, types, and methods, as well as implicitly parameterized methods related to the polymorphic functions commonly found in functional languages. By making type declarations optional, Cecil aims to allow mixing of and migration between exploratory and production programming styles. Cecil supports a module mechanism that enables independently-developed subsystems to be encapsulated, allowing them to be type-checked and reasoned about in isolation despite the presence of multi-methods and subclassing. Objects can be extended externally with additional methods and instance variables, often encapsulated in separate modules, supporting a kind of role-based or subject-oriented programming style.

This document describes the design of the Cecil language as of December 1995. It mixes the specification of the language with discussions of design issues and explanations of the reasoning that led to various design decisions.

Table of Contents

1 - Introduction
1.1 - Design Goals and Major Features
1.2 - Overview
2 - Dynamically-Typed Core
2.1 - Objects and Inheritance
2.1.1 - Inheritance
2.1.2 - Object Instantiation
2.1.3 - Extension Declarations
2.1.4 - Predefined Objects
2.1.5 - Closures
2.2 - Methods
2.2.1 - Argument Specializers and Multi-Methods
2.2.2 - Method Bodies
2.2.3 - Primitive Methods
2.3 - Fields
2.3.1 - Read-Only vs. Mutable Fields
2.3.2 - Fields and Methods
2.3.3 - Copy-Down vs. Shared Fields
2.3.4 - Field Initialization
2.4 - Predicate Objects
2.4.1 - Predicate Objects and Inheritance
2.4.2 - Predicate Objects and Fields
2.5 - Statements and Expressions
2.5.1 - Declaration Blocks
2.5.2 - Variable Declarations
2.5.3 - Variable References
2.5.4 - Assignment Statements
2.5.5 - Literals
2.5.6 - Message Sends
2.5.7 - Object Constructors
2.5.8 - Vector Constructors
2.5.9 - Closures
2.5.10 - Parenthetical Subexpressions
2.6 - Precedence Declarations
2.6.1 - Previous Approaches
2.6.2 - Precedence and Associativity Declarations in Cecil
2.7 - Method Lookup
2.7.1 - Philosophy
2.7.2 - Semantics
2.7.3 - Examples
2.7.4 - Strengths and Limitations
2.7.5 - Multiple Inheritance of Fields
2.7.6 - Cyclic Inheritance
2.7.7 - Method Lookup and Lexical Scoping
2.7.8 - Method Invocation
2.8 - Resends
2.9 - Files and Include Declarations
2.10 - Pragmas
3 - Static Types
3.1 - Goals
3.2 - Types and Signatures
3.3 - Type and Signature Declarations
3.3.1 - Type Declarations
3.3.2 - Representation and Object Declarations
3.3.3 - Type and Object Extension Declarations
3.3.4 - Signature Declarations
3.3.5 - Implementation and Method Declarations
3.3.6 - Field Implementation Declarations
3.3.7 - Other Type Declarations
3.3.8 - Discussion
3.4 - Special Types and Type Constructors
3.4.1 - Named Types
3.4.2 - Closure Types
3.4.3 - Least-Upper-Bound Types
3.4.4 - Greatest-Lower-Bound Types
3.5 - Object Role Annotations
3.6 - Type Checking Messages
3.6.1 - Checking Messages Against Signatures
3.6.2 - Checking Signatures Against Method Implementations
3.6.3 - Comparison with Other Type Systems
3.6.4 - Type Checking Inherited Methods
3.7 - Type Checking Expressions, Statements, and Declarations
3.8 - Type Checking Subtyping Declarations
3.9 - Type Checking Predicate Objects
3.10 - Mixed Statically- and Dynamically-Typed Code
4 - Parameterization and Parametric Polymorphism
4.1 - Explicit Parameterization
4.1.1 - Parameterized Declarations and Formal Type Parameters
4.1.2 - Instantiating Parameterized Declarations
4.1.3 - Parameterized Objects and Types
4.1.4 - Method Lookup
4.1.5 - Type Checking Instantiations
4.2 - Implicit Parameterization
4.3 - Matching Against Type Patterns
4.3.1 - Method Formal Type Patterns
4.3.2 - Upper Bound Type Patterns
4.3.3 - The Matching Algorithm
4.3.4 - Static vs. Dynamic Matching
4.3.5 - Constraints on Supertype Graphs for Matching
4.3.6 - Matching and Bounded Formal Type Parameters
4.4 - Implicit Type Parameters in Extension Declarations
4.5 - Parameterized Objects and Method Lookup
4.6 - Parameterization and Syntactic Sugars
4.7 - F-Bounded Polymorphism
4.7.1 - Motivation
4.7.2 - F-Bounded Polymorphism in Singly-Dispatched Languages
4.7.3 - F-Bounded Polymorphism in Cecil
4.7.4 - F-Bounded Polymorphism among Multiple Types
5 - Modules
6 - Related Work
7 - Conclusion
Acknowledgments
References
Appendix A - Annotated Cecil Syntax
A.1 - Grammar
A.2 - Tokens
A.3 - White Space

Cecil Language Reference Manual - 12 SEP 96
[Next]