Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!hellgate.utah.edu!caen!sdd.hp.com!hplabs!otter.hpl.hp.com!hpltoad!cdollin!kers From: kers@hplb.hpl.hp.com (Chris Dollin) Newsgroups: comp.object Subject: Re: The Emperor Strikes Back Message-ID: Date: 22 Feb 91 08:39:52 GMT References: <3351@sequent.cs.qmw.ac.uk> Sender: news@hplb.hpl.hp.com (Usenet News Administrator) Organization: Hewlett-Packard Laboratories, Bristol, UK. Lines: 74 In-Reply-To: steve@cs.qmw.ac.uk's message of 15 Feb 91 20:50:37 GMT Nntp-Posting-Host: cdollin.hpl.hp.com Steve Cook writes a vigerous rebuttal of Scott Guthery's article (alas, I have not read the original; like a *really* bad book, I might have enjoyed it). I wish to respond to two points. Steve says: What is an object? According to Guthery, 'stripped of its fancy jargon, an object is a lexically-scoped subroutine with multiple entry points and persistent state'. If that's not fancy jargon, I don't know what is; but let's have a closer look at it. The killer is 'lexically-scoped'. It's a while since I heard the phrase, so I checked it in Abelson and Sussman's book, 'Structure and Interpretation of Computer Programs'. According to them, lexical scoping means that free variables in procedures are statically bound to variables in textually-enclosing procedures, just like free variables in nested procedures in Pascal. But the most fundamental idea of object-oriented programming is dynamic binding of operation names to operations at run-time. Lexical scoping has nothing whatever to do with objects. Can somebody who's failed so completely to grasp the basic idea be trusted to criticise the whole technology? Guthery is "right" (ie, that is indeed one way of regarding an object; I'm not sure that it says anything new). I think Guthery is thinking of an objectish implementation in a Lisp-like (actually this example is Pop-like, but the principle's the same) language where we might say: define new_object( f1, f2, f3 ) as procedure ( method ) as if method == "m1" then m1_expression( f1, f2, f3 ) elseif method == "m2" then m2_expression( f1, f2, f3 ) ... endif enddefine the m1_expression (etc) are the expressions for the method bodies. The if-expression encodes "multiple entry points". The fi are the persistent state, because they are lexically-scoped variables, and full lexical scope is used to smuggle them into the procedure representing the object. An object is thus represented as a procedure which, when applied to an method-name argument, does "the appropriate thing". I seem to recall that such a method is described in Abelson and Sussman. It's nice that it can be done at all, but it's not as nice as supporting the object orientation (whatever that means ...) directly in the language. I *don't* think you can use it as evidence that Guthery has "failed so completely to grasp the basic idea" of OOP. (You may, or course, have other evidence.) Steve also says: Consequences of Persistent State It seems as if what Scott Guthery means by persistent state is what most people mean by data abstraction. If he thinks that data abstraction is a semantic minefield to be avoided, he's missed out on the last 20 years of programming methodology. Not having read the original, I can't tell if Guthrey really does mean "data abstraction" when he says "persistent state". I presume he means that objects have little pieces of state inside them (I sometimes call them "statelets") which persist for the lifetime of the object and result (in reference-based OOLs, in any case) in the possibility of lots of aliasing (I send a message to O1, and some O2 gets changed as a result). This is a source of great power, but it can be a source of great confusion too (witness, for example, the advocates of functional languages, who are so worried by the non-transparency of states that they design state-free languages [*1]). I'm not sure that I'd call it a "semantic minefield", however. [*1] I myself am an advocate of functional languages, when I havn;t got my Pop11 hat on ... -- Regards, Kers. | "You're better off not dreaming of the things to come; Caravan: | Dreams are always ending far too soon." Brought to you by Super Global Mega Corp .com