Path: utzoo!censor!geac!torsqnt!lethe!yunexus!ists!helios.physics.utoronto.ca!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!decwrl!asylum!osc!jgk From: jgk@osc.COM (Joe Keane) Newsgroups: comp.object Subject: Re: The Emperor Strikes Back Summary: Objects are lexically scoped. Keywords: scope, binding Message-ID: <4572@osc.COM> Date: 26 Feb 91 20:04:24 GMT References: <3351@sequent.cs.qmw.ac.uk> Reply-To: jgk@osc.COM (Joe Keane) Organization: Versant Object Technology, Menlo Park, CA Lines: 28 I don't want to get into a big debate about Guthery's article, but i would like to comment on the `lexically scoped' issue. Steve Cook's argument against lexical scoping is that the actual routine which is called depends on which object the method is called on. This is true, but i don't think it contradicts lexical scoping. Taking this argument to the extreme, we could say that C structs are not lexically scoped because the value of a field depends on what struct you look at. This is simplistic, but it shows where i'm coming from. In languages like C++ an object belongs to some actual class, and the routine to be run is determined entirely by this class. The actual class is lexically scoped, but a class which includes subclasses is not lexically scoped. A given instance may be of an unknown (to the base class) subclass, so it has no idea what routine will actually be called. I think this is what Steve's argument really says. We just have to be clear about whether we're talking about an object, an actual class, or a class including subclasses. By the way, i really wish there were separate words for the last two concepts. To make this a little more clear, let's try to imagine what dynamic scoping would mean. In Common Lisp we can declare some variables special, so let's try the same thing for methods. This would mean that you could change the definition of a method in some routine, maybe for a given object or for a whole class. It could be changed permanently, or when you leave it could be restored to its original definition. This isn't supported by C++, unless of course you bash the virtual function tables. It seems like a neat idea, although i'm not sure how useful it really is. FL advocates would say this causes more problems than it solves, and i think i agree.