
A Glimpse of Paradise Hassan Ait-Kaci Digital Equipment Corporation Paris Research Laboratory 85, avenue Victor Hugo 92563 Rueil-Malmaison Cedex France email: [email protected] Abstract Having understood that most attractive programming paradigms introduced re- cently in declarative symbolic programming languages need not be provided at the detriment of one aalother, we also believe that they can and should coexist with the more conventional state-effecting style of explicit control and data processing of imperative programming. To this end, we language designers must provide three primeval abstractions which could allow retrieving of most particular programming styles as particular instances, with the additional freedom of manipulating these abstractions explicitly. In the next decade, computer programming should allow specifying (1) abstract data structures, (2) abstract control structures, and (3) ab- stract constraint structures. With these basic ideas in mind, we shall propose and sketch a specific design for a language and lay out some explicit requirements. Doing so, we shall try to compare this attempt to the state of the art. It is true, that as the form often does not accord with the intention of the art, because the material is deaf to respond, so the creature sometimes deviates from due course; ... Dante Alighieri The Divine Comedy--Paradise, Canto I:121 Motivation It is clear that there exists a wide chasm separating the present day's "real-life" pro- gramming languages and the state of understanding of powerful high-level programming paradigms. The former provide low-level primitives and complete specific command of data and control. This results in efficiency but at the cost of prohibitive program devel- opment overhead. On the other hand, high-level programming languages offer elegant and powerful abstractions such as polymorphic typing and constraint-solving, but impose 18 overly restrictive programming styles often excluding the more familiar and sorely missed constructs. Now, we believe that the application software market of the 90's will comprise as a large part programs for advanced data and knowledge representation, graphics ob- ject manipulation or reasoning thereof, natural language processing, CAD, hardware design verification, combinatorial optimization and problem-solving. These exemplify a category of programming challenges whose realization in conventional programming lan- guages is currently very difficult and time-consuming. However, today's constraint-based languages, although providing adequate tools for specific problem domains, still confine the user to canned structures leading to unacceptable inefficiencies. Thus, it is imperative to build a more appropriate programming environment than either side of the gap. To structure our argument, we shall word this essay as a pro- posal to design and build a prototypical programming environment of the 90's--dubbed Paradisel--whose building blocks will reflect our technical assessment of its required functionality. Namely, it must incorporate general and versatile abstractions to support direct execution of high-level constraint specifications coexisting along with the famil- iar imperative programming paraphernalia. This is bound to facilitate significantly the development of advanced applications such as we have in mind. Our key insight is based on our having understood that most attractive programming paradigms introduced recently in declarative symbolic programming languages need not be provided at the detriment of one another. This fact is clearly demonstrated and amply illustrated in [AKN86,AKN89,AK90,AKP90,AKP91,AKM90]. More importantly, they need not preclude the more conventional state-effecting style of explicit control and data processing of imperative programming [FF89,Fe187]. Therefore, we believe that it is quite feasible to set up a concrete and rigorous design plan based on building three primeval abstractions which could allow retrieving of most particular programming styles as instances, with the additional freedom of manipulating these abstractions explicitly. Namely, programming in Paradise should allow specification of: 1. abstract data structures; 2. abstract control structures; 3. abstract constraint structures. The first item is perhaps the most familiar and used through the machinery of mod- ules, with added power supplied by generic modules. The second and third points are less conventional, the second one having already been under serious investigation and the last one being quite new. With these basic ideas in mind, we can sketch a specific design for a language and lay out some explicit requirements. The Design We offer to design and implement Paradise as a programming system combining compu- tational paradigms from Constraint Logic Programming [JL87,HS88], Object-Oriented Programming [GR80] and Typed Functional Programming [IIMT88]. The system will 1Since it comes after LIFE [AK90] and could very well take a long time to be reached. 19 allow for a free mixture of efficiency-oriented imperative programming with specification- oriented declarative programming. At the same time, the system will be simple. Sim- plicity will be achieved by having only a small number of basic constructs, which are general and fit nicely together. The language must have one uniform, record-like data structure based on classes and features. Classes are organized as an inheritance hierarchy and all operations are bound to classes. The type system supports a few built-in polymorphic classes such as pairs, lists, and arrays. Other parametric data structures can be implemented by means of generic modules. Well-typedness is checked before program execution. Execution of well-typed code is guaranteed to map well-typed memory states to well-typed mem- ory states [Coo89]. Programs are then naturally organized as hypergraphs of possibly parametric modules. The consistency of the module structure is checked automatically. The programming system will be interactive and incremental. A program consists of a hypergraph of modules that is created, inspected, and modified through a window and menu oriented user interface. Module and type checking as well as compilation are incremental and are done as early as possible [CCHO89]. Code that has passed the type checker can be executed immediately. Operators can take the form of functions, relations and procedures. Operators are first-class objects. Operators are uniformly declared with a rank ~ ---, r, where ~r is the type of the input argument (there is always exactly one) and r is the type of the result. Functions do not have side-effects. Relations have monotonic side effects; that is, they can impose additional constraints on existing values. Procedures have hard side-effects; that is, they can nonmonotonically update the fields of a value. The language is equipped with a type-safe exception handling similar to ML. However, imposition of constraints and updates of fields can be trailed, which means that upon return to a choice point (called an exception handler in ML) the initial memory state may be recovered automatically. This yields exception controlled backtracking, which is more powerful than the chronological backtracking underlying Prolog [CM84,SS86,O'K90]. One of the most innovative aspects of the language is the integration of constraint solving. On the well-understood side, the language will support unification with re- spect to its data structure, which amounts to sorted feature unification as realized in LogIn [AKN86]. In addition, built-in constraint solving methods are accommodated for common useful applications such as numerical problems and propositional logic. The well-founded and efficient integration of these three families of methods alone will make for an interesting subproject. Finally, it must be made possible to program new constraint solving methods. Finding the right control primitives and the appropriate abstraction mechanisms for this task is an open research problem, solutions of which should provide for a major breakthrough in programming. Partial Data Representation Types are organized in a partial order hierarchy (inheritance). Data is uniformly repre- sented as feature structures (attributed objects). This structure of objects respects type schemas (classes). The advantage of the fact that there is no (conceptual) difference between values and types is that data may be added attributes compositionally and (variable) binding may 20 dereference (binding identification) type/value attributes constraint closures Figure 1: Partial Data Objects set of variabies I (object pointers) suspended code . l Figure 2: Constraints as Closures be seen as object identification. This has unusual pay-offs. First, compile-time resolves some but not all types. Second, there is no need to distinguish between of case and typecase [Rov86]. Third, binding as data identification gives a natural interpretation of pointers as equivalence classes of references (coreference classes), and allows selectively undoable side-effects. Abstract Constraint Solving Recent work in Logic Programming has shown that Prolog's unification can be generalized to arbitrary (decidable) constraint-solving, as long as is provided an appropriate data representation and interpretation thereof, and a constraint-solver in the form of a relevant decidable, correct (sound and complete) algorithm on these structures [JL87,ttS88]. This provides great possibilities to execute declarative specifications as programs. Thus, constraint-solving
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages9 Page
-
File Size-