Multiparadigm Programming with Object-Oriented Languages
Total Page:16
File Type:pdf, Size:1020Kb
NIC John von Neumann Institute for Computing Publication Series of the Jörg Striegnitz, Kei Davis, John von Neumann Institute for Computing (NIC) Yannis Smaragdakis (Eds.) The John von Neumann Institute for Computing was established in 1998 by the Research Centre Jülich and the German Electron Synchrotron Foundation DESY in order to support supercomputer-aided scientific and engineering research and development in Germany with the following tasks: Multiparadigm • Nationwide provision of supercomputer capacity for projects in science, Programming with research, and industry. Object-Oriented Languages • Supercomputer-oriented research and development by research groups of competence in supercomputing applications. • Education and training in the fields of supercomputing by symposia, workshops, summer schools, seminars, and courses. Multiparadigm Programming with Object-Oriented Languages Proceedings Forschungszentrum Jülich Deutsches in der Helmholtz-Gemeinschaft Elektronen-Synchrotron J. Striegnitz, K. Davis, Y. Smaragdakis NIC Series Volume 13 ISBN 3-00-009099-1 13 Central Institute for Applied Mathematics Publication Series of the John von Neumann Institute for Computing (NIC) NIC Series Volume 13 John von Neumann Institute for Computing (NIC) Jorg¨ Striegnitz, Kei Davis, Yannis Smaragdakis (Eds.) Multiparadigm Programming with Object-Oriented Languages (MPOOL) 2nd International Workshop, 11 June 2002 Malaga, Spain Proceedings organized by John von Neumann Institute for Computing in cooperation with Los Alamos National Laboratory, New Mexico, USA Georgia Institute of Technology, Georgia, USA NIC Series Volume 13 ISBN 3-00-009099-1 Die Deutsche Bibliothek – CIP-Cataloguing-in-Publication-Data A catalogue record for this publication is available from Die Deutsche Bibliothek. Publisher: NIC-Directors Distributor: NIC-Secretariat Research Centre Julich¨ 52425 Julich¨ Germany Internet: www.fz-juelich.de/nic Printer: Graphische Betriebe, Forschungszentrum Julich¨ c 2002 by John von Neumann Institute for Computing Permission to make digital or hard copies of portions of this work for personal or classroom use is granted provided that the copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. To copy otherwise requires prior specific permission by the publisher mentioned above. NIC Series Volume 13 ISBN 3-00-009099-1 Preface This volume contains the proceedings of the International Workshop on Multi- paradigm Programming (MPOOL'02), held in Malaga, Spain on June 11, 2002. Although the idea of combining programming paradigms and languages goes back to the late sixties, when a lot of research effort was spent on the development and investigation of extensible programming languages, this approach has lost neither its importance, nor its elegance. Programming languages and paradigms are thought models. Their distin- guishing concepts have a great influence on how programmers approach the different stages of the software development process. With respect to software quality, it is therefore desirable to let the problem domain determine the choice of the programming paradigm. Especially for larger software projects, this implies the need for languages and tools that support the simultaneous use of different programming paradigms. Today the object oriented programming paradigm is dominant and ubiqui- tously employed for design, implementation and even conceptualization and a huge set of tools has been developed and successfully applied over the last two decades. MPOOL tries to bring together people who are trying to build a bridge from OO-centered tools to a toolset that permits free choice of paradigms. Last year's MPOOL gave evidence that there exists a larger community work- ing in this emerging area. The extended diversity of topics of this year's work- shop shows that there is an ongoing advance in programming languages, tools, concepts and methodologies to support multiparadigm programming. One of the main goals of the workshop (and the reason of publishing this proceedings volume) is to promote and expose work that combines programming paradigms in the framework of OO languages. Building a consensus about the standard background work, the interesting problems, and the future directions is the way to form a community. Acknowledgment. We wish to heartily thank all the authors for writing very interesting papers and all the members of the Programme Committee for their invaluable help in compiling the program. June 2002 Kei Davis Yannis Smaragdakis J¨org Striegnitz Workshop Organizers Kei Davis, Los Alamos National Laboratories, New Mexico, USA Yannis Smaragdakis, Georgia Institute of Technology, Georgia, USA J¨org Striegnitz, John von Neumann Institute for Computing, Germany Programme Committee Gerald Baumgartner, Ohio State University, Ohio, USA Kei Davis, Los Alamos National Laboratory, New Mexico, USA Jaakko J¨arvi, Indiana University, Indiana, USA Peter Van Roy, Universite catholique de Louvain, Belgium Yannis Smaragdakis, Georgia Institute of Technology, Georgia, USA J¨org Striegnitz, John von Neumann Institute for Computing, Germany Table of Contents Object Programming in a Rule-Based Language with Strategies : : : : : : : : : : 1 Hubert Dubois, H´el`ene Kirchner Modelica - A Declarative Object Oriented Multi-Paradigm Language.: : : : : 27 Peter Fritzson, Peter Bunus The Return of Jensen's Device : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 45 Timothy A. Budd Towards Linguistic Symbiosis of an Object-Oriented and a Logic Program- ming Language : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 65 Johan Brichau, Kris Gybels, Roel Wuyts Replacing Refinement or Refining Replacement? : : : : : : : : : : : : : : : : : : : : : : : 79 Sibylle Schupp Java-Style Variable Binding in C++ : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 97 Thomas Becker Dynamic Inheritance for a Prototype-based Language : : : : : : : : : : : : : : : : : : 109 Koji Kagawa A case in Multiparadigm Programming : User Interfaces by means of Declarative Meta Programming : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 121 S. Goderis, W. De Meuter, J. Brichau iv Object Programming in a Rule-Based Language with Strategies Hubert Dubois, H´el`ene Kirchner LORIA-Universit´e Nancy 2 & LORIA-CNRS BP 239 54506 Vandœuvre-l`es-Nancy Cedex, France fHubert.Dubois|[email protected] Abstract. This paper presents a programming framework that com- bines the concepts of objects, rules and strategies, built as an extension of the rule-based language with strategies ELAN. This extension is imple- mented in a reflective way in ELAN itself and relies on the same formal semantics, namely the ρ-calculus. 1 Introduction Object-based languages and rule-based languages have independently emerged as programming paradigms in the eighties. Languages like Ada [Ros92], Smalltalk- 80 [GR83], Eiffel [Mey92] or Java [AG96] are well-known and largely used but often lack of semantical basis. Rule-based systems, initially used in the artificial intelligence community, have gained interest with the development of efficient compilers. The ELAN system [BCD+00] provides a very general approach to rule-based programming. ELAN offers an environment for specifying and prototyping de- duction systems in a language based on rewrite rules controlled by strategies. It gives a natural and simple logical framework for the combination of computa- tion and deduction paradigms. It supports the design of theorem provers, logic programming languages, constraint solvers and decision procedures and offers a modular framework for studying their combination. ELAN has a clear operational semantics based on rewriting logic [BKKR01] and on rewriting calculus [Cir00]. Its implementation involves compiled matching and reduction techniques inte- grating associative and commutative functions. Non deterministic computations return several results whose enumeration is handled thanks to a few constructors of choice strategies. A strategy language is available to control rewriting. Evalu- ation of strategies and strategy application is again based on rewriting. However, ELAN lack object oriented features, the notion of states, which provides more structuration, and the ability to define structures sharing the same properties. More recently, the combination of object-based languages and rule-based lan- guages has proved to be quite relevant to formalize and solve advanced industrial problems that require some form of reasoning. Among many other languages, let us mention three of them, more closely related to our approach: CLAIRE [CL96], Oz [HSW95] and Maude [CDE+00]. 1 CLAIRE is combines objects and propagation rules in the logic programming style for problem solving and combinatorial optimization. Single inheritance and full polymorphism are supported. CLAIRE has been realized to deal with appli- cations with complex data structures with the ability to define rules. CLAIRE rules associate a logical condition with an expression composed by one or two objects: when a condition is evaluated into true, the expression is evaluated for the given objects. Conditions are events that denote an evolution of an entity (creation of an object, modification of an attribute, etc...). Rules can be grouped together but control is not explicit. Oz is a concurrent object oriented constraint language that offers multiple inheritance, higher-order