Path: utzoo!attcan!uunet!aplcen!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!cica!iuvax!maytag!mks.com!bruce From: bruce@mks.com (Bruce Payette) Newsgroups: comp.lang.misc Subject: Re: Algol, and language design Message-ID: <1990Jul31.140908.19614@mks.com> Date: 31 Jul 90 14:09:08 GMT References: <25630@cs.yale.edu> <58091@lanl.gov> <25767@nigel.udel.EDU> <2417@l.cc.purdue.edu> <26058@nigel.udel.EDU> Reply-To: bruce@mks.com (Bruce Payette) Organization: Mortice Kern Systems, Waterloo, Ontario, Canada Lines: 55 In article <26058@nigel.udel.EDU> carroll@udel.edu (Mark Carroll ) writes: >In article <2417@l.cc.purdue.edu> cik@l.cc.purdue.edu (Herman Rubin) writes: >] >]You like an object-oriented language, and you like a functional language. >]Why not combine everything? It is not so much a problem for the language >]designer as for the compiler writer. >] > >What you're asking for doesn't even make good sense. Yes, I like oo >languages. And I like functional languages. But combine them? It doesn't >make good sense. > >A program in any language is a description of a machine. The language >that you use determines what kind of machine your program is >describing. In an Algol like language, you're basically modelling a >vonNeumann machine. In Smalltalk or Self, you're modeling a >message-passing machine. In Haskell, you're modeling a machine that >does lambda calculus expansion. The models don't necessarily mix. If I >mix the message-pass model of Smalltalk, and the functional model of >Haskell, I end up with a monstrosity that destroys that attractive >features of both! In a big way, the thing that makes Smalltalk so good >at solving certain problems is its idea of object identity, where the >object contains its own state. The primary advantage of a language >like Haskell is the total lack of mutable state. How can I combine >those two? It makes no sense, because the underlying machine models of >the two languages are so radically different. > > >-- >|Mark Craig Carroll: |"We the people want it straight for a change; >|Soon-to-be Grad Student at| cos we the people are getting tired of your games; >|University of Delaware | If you insult us with cheap propaganda; >|carroll@dewey.udel.edu | We'll elect a precedent to a state of mind" -Fish Actually some work has been done on combining the oo and functional paradigms. The Cosmos project at Newcastle-on-Tyne(?) has proposed a system (operating- system not a language) based on a mix of the two approaches. Objects are immutable - they can only be created. "Methods" (or whatever you choose to call them) are associated with objects but can only create a new object which is a modified COPY of the old one. No object is ever changed. This fulfills the principle of immutability required by the functional programming paradigm but also allows you to use oo. (Actually the notation looks more like parametric polymorphism than OOPS, a minor(?) religious point). Another approach to "combining" the various paradigms is in a multi-paradigm programming system. The various facilities are available, but aren't really merged. The Xerox Interlisp/LOOPS system is one of the best examples of this. It allows you to combine functional, procedural, object-oriented, rule-based and God knows what else all in the same program. The POPLOG system also has similar features. -- --Bruce Payette, Mortice Kern Systems Inc., 35 King Street N., Waterloo, Ont. Internet: bruce@mks.com UUCP: ..!uunet!watmath!mks!bruce