ebook img

The Interpretation of Object-Oriented Programming Languages PDF

295 Pages·2002·9.388 MB·
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview The Interpretation of Object-Oriented Programming Languages

The Interpretation ofObject-Oriented Programming Languages Springer-Verlag London Ltd. lain Craig The Interpretation of Object-Oriented Programming Languages Second Edition , Springer lain Craig, MA, PhD British Library Cataloguing in Publication Data Craig, Iain D. The interpretation of object-oriented programming languages. - 2nd ed. 1. Object-oriented programming (Computer science) 2. Programming languages (Electronic computers) 1. Title 005.1'17 ISBN 978-1-85233-547-2 Library of Congress Cataloging-in-Publication Data Craig, 1. The interpretation of object-oriented programming languages / Iain D. Craig.. --2nd ed. . p.cm. Includes bibliographical references and index. ISBN 978-1-85233-547-2 ISBN978-1-4471-0199-4 (eBook) DOI 10.1007/978-1-4471-0199-4 1. Object-oriented programming (Computer science) 1. Title. QA76.64 .C73 2001 005.l'17-dc21 2001040621 Apart from any fair dealing for the purposes of research or private study, or criticism or review, as permitted under the Copyright, Designs and Patents Act 1988, this publication may only be reproduced, stored or transmitted, in any form or by any means, with the prior permission in writing of the publishers, or in the case of reprographic reproduction in accordance with the terms of licences issued by the Copyright Licensing Agency. Enquiries conceming reproduction outside those terms should be sent to the publishers. ISBN 978-1-85233-547-2 http://www.springer.co.uk © Springer-Verlag London 2002 Origina1ly published by Springer-Verlag London Limited in 2002 First published 2000 Second edition 2002 The use of registered names, trademarks etc. in this publication does not imply, even in the absence of a specific statement, that such names are exempt from the relevant laws and regulations and therefore free for general use. The publisher makes no representation, express or implied, with regard to the accuracy of the information contained in this book and cannot accept any legal responsibility or liability for any errors or omissions that may be made. Typesetting: camera-ready by author Printed and bound at the Athemeum Press Ltd, Gateshead, Tyne and Wear 34/3830-543210 Printed on acid-free paper SPIN 10847137 For Adam Preface to the Second Edition I was extremely surprised to learn that this book was so wellreceived;I was even more surprised when a second edition was proposed. I had realised that there was a need for a book such as this but had not thought that the need was as great; I really wrote the book for myself, in order better to organise my thoughts on object-oriented languages and better to understand them. For the second edition, I have found and corrected mistakes and have added a completely new chapter on the C# language. The chapteron mixed paradigm languages has been relegated to an appendix, and a new appendix on the BeCecil language has been added. - C# isextremely popular. Given its apparent role as the major competitor to Java, it was clear that a chapter was necessary in which a comparison could be made. That chapter concentrates on the language and not on the runtime and support system. C# contributes some new features to the C++ derivatives. The language has rough edges (as Java does still). It will be interesting to watch its development and to see whether it becomes accepted more widely. The appendix on BeCecil is added so that the coverage of Cecil can be a little more comprehensive. When writing the first edition, I was unable to obtain copies of the Cecil definition, which turned out to be a much larger (and more fascinating) document than I had thought. Given the time allo cated to me for the production of the second edition, it was impossible to include more on Cecil-a complete chapter seemed necessary. The existence of BeCecil, a core language, seemed perfect for my needs. Cecil and BeCecil are ofinterest because they rationalise much ofobject-oriented programming languages. I believe that weneed more of this and that Cecil points the way towards the future. The mixed-paradigm languages chapter was relegated to an appendix be cause there appears to be little work in the field. My major disappointment since writing the first edition isthat databases and prototype-based languages have still failed to converge. The reason for this is, probably, that prototype-based languages are still a highly specialist area and the languages that do exist are still research prototypes. There is an ample literature in the AI area on the combination of prototype-like structures with long-term storage upon which to base proposals. Perhaps VIII Preface to the Second Edition this is either too obscure or acts to deter research. Perhaps there is work out there that I have not seen. Acknowledgements. Iwouldfirst liketo thank BeverleyFord, RebeccaMowat and all at Springerfor their help in producing this and thefirst edition. They left mealone to get on with it, and answeredquestionsquickly and accurately. My brother Adam drew the figures and madea variety ofsuggestions; for the second edition, his comments on what.10 include and what to exclude were extremelyhelpful. Margaretdeserves specialthanksforher moralsupportand encouragement, even though she is far away. I would also like to thank my good friend Walter Connor for his encouragement and for the great kindness he has shown towards me. Finally,and this seems unjustly neglected, I would liketo thank those who have bought the book, for,without them, this edition would not have come about.I hope the book isstill ofuse and willstimulate people to think about programming languages and the way in which we program. lain Craig Merrion Dublin June 2001 Preface Object-oriented languages are probably the most important development in computing for many years. They allow us to describe and to model the phys ical as well as more abstract worlds.They allow us to provide the computa tional entities wedescribe with a dynamics that isencapsulated, thus leading to a more distributed notion of state, a notion which, inter alia, makes pro gramming and analysis somewhat more tractable. Unfortunately,ifone wants to understand the concepts that are currently employed in object-oriented languages, one must refer to the proceedings of conferences such as OOPSLA or EGOOP. These proceedings might be hard to obtain or obscure; in any case, without a background in the area, the reader will almost certainly encounter concepts which willsend them back to the literature. The aim of this book is to provide,in one place, an interpretation of the primary concepts in object-oriented programming languages. In some cases, for example, multiple inheritance, there is no single interpretation that is accepted by all; in such cases, the different approaches are explained. An attempt has been made to be as comprehensive as possible, but certain con cepts have been omitted for the reason that they are not often encountered or they have fallen from grace. The concept of the instantiable module appears to be one example of this. This having been said, it was, at all times, considered to be important to cover as many languages as possible in order to give as great a coverage as possible. Thus, the reader will find references to many languages that have been derived from LISP (it must be remembered that a considerable amount of research into object orientation was done in the LISP and AI communi ties before it became fashionable or appropriate to software engineering in general). Oneareain which morework isrequired isin prototype-basedlangauges;I believe that they are an extremely important development and that they will assume considerableimportanceas time progresses. However,there have only been a very fewlarge-scaleattempts at producing prototype-based languages and the area is still a relatively immature one. The relationships between prototype-based languages and databases have yet to be explored (and one might find some interesting advances), as has reflection. X Preface My own research area of computational reflection is also included in this book. I have,though, been extremely careful only to include material that is directly relevant to the rest of the book and not to be speculative in what I have included. There is, contrary to the view of some, a great deal more work required in the area of computational reflection and its implications for computing in general are insufficiently clear. The chapter on reflection is, therefore, less wide-ranging and less "aggressive" than I would have liked. Having read the chapter, the interested reader should try to read the imple mentation chapters in Goldbergand Robson's excellent bookon Smalltalk-80 (the so-called "Blue Book"). The book is, sadly, out of print, but many li braries still carry copies; it is an exciting book and, for those interested in reflection, amply repays the effort required to obtain it. Finally, I have included a chapter on a so-called 'mixed paradigm' language, one combining functional and object-oriented concepts. Mixed paradigm languages combine the best features of different ways of constru ing programming and computation. It is possible that research into mixed paradigm languages willpresent us with new concepts and approaches to the programming process. The combination I have adopted in this book appears to hold out the promise that program transformation can be performed in various ways; in particular, it suggests that, if we include reflective capa bilities in such a language, we can engage in meta-programming in various ways, one of which is program transformation. Given the general policy on speculation, these issues are not considered further. Acknowledgements. I would like to thank Gunter Blaschek for his review of the manuscript;his comments havehelped considerably.Next,Iwould liketo thank my brother Adam for drawing the figures, for reading the manuscript and for suggesting ways in which the text could be made easier to read. My wife, as ever,has supported me constantly throughout the writing of the manuscript and has often acted as asounding board when I have been unsure as to how I should phrase things (and has always urged me to continue when things looked bad);for this, I thank her.Rebecca (Moore) Mowat ofSpringer deservesspecial thanksfor her calm attitude to the writingand completion of the manuscript during a period in which I had to pay considerable attention to other matters. lain Craig Merrion Dublin December 1999 Contents 1. Introduction ... .................. .. .... .... .. .... .... .... . 1 1.1 Introduction .. ....... ..... ...... .... .. .. .. ..... .. .. .... 1 1.2 Essential Properties of Objects ........................... 2 1.3 Objects and Messages. .................................. 5 1.4 Pure and Impure Languages. ............................ 7 1.5 Mixed-Paradigm Languages.............................. 8 1.6 Organization of this Book 8 2. Class Fundamentals.. ...... .......... .............. ....... 13 2.1 Introduction. .. ..... ... ..... .... ........ .... ... ........ 13 2.2 Classes.. ......... .. ... ..... .. .. .. .. .. .. .. ..... ........ 15 2.3 Instances. .... .. .. ...... ... .... .. .... .... .... ...... .... 19 2.4 Slots and Methods...................................... 21 2.5 Slot Access ............................................ 22 2.6 Visibility and Accessibility ............................... 24 2.7 Instance Creation 29 2.8 Inheritance.. .... .......... .... ............. .. ......... 32 2.8.1 Introduction. .... .. ....... .... ... ....... ... ..... . 32 2.8.2 Definition of Inheritance 33 2.9 Abstract Classes 38 2.10 Iterators 42 2.11 Part Objects. .......................................... 46 3. Prototype and Actor Languages. .... ..................... 53 3.1 Introduction .. ..... .... .. .. ...... ... .... ... .... ........ 53 3.2 Prototype Languages 53 3.2.1 The Concept of the Prototype 54 3.2.2 Slots and Methods................................ 59 3.2.3 Message Passing 60 3.2.4 Creating New Objects 61 3.2.5 Delegation and Shared Structure " 62 3.3 Methods in Prototype Languages ......................... 66 3.4 Actor Languages. ...................................... 67 3.4.1 Introduction .... .. .. ..... .. .. .. ......... ......... 67

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.