Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!pt.cs.cmu.edu!dsl.pitt.edu!pitt!willett!dwp From: dwp@willett.pgh.pa.us (Doug Philips) Newsgroups: comp.lang.forth Subject: Re: ... and zen there were objects. Message-ID: <1498.UUL1.3#5129@willett.pgh.pa.us> Date: 10 Aug 90 03:59:00 GMT References: <1990Aug7.081509.2315@idacom.uucp> Organization: String, Scotch tape, and Paperclips. (in Pgh, PA) Lines: 66 In <1990Aug7.081509.2315@idacom.uucp>, rob@idacom.uucp (Rob Chapman) writes: I was going to reply to your message specificly, but decided that it would rather make a good jumping off point for something that I've just recently put my finger on. I don't intend this to discourage you, or anyone else, from making posts of the quality that you made. I have not read all of the existing Forth literature, but I would be surprised if what I have to say has not been said before. What I think is wrong with Object Oriented Extensions to Forth: All the OOEF's I have seen so far involve active objects or messages or both. By active I mean that the words are IMMEDIATE words. I have a couple of problems with active obects and messages. Take for example Pountain's system as described in his book. Objects are active. That means that all objects must have names. In order to create arrays of objects, one must create special active arrays. From this it seems to follow that one must create special active versions of other things that involve objects. It also means that you cannot have anonymous objects. That is in part what annoys me most. You cannot write a word which will "return" (i.e. leave on the top of the stack) an object. I think you could probably cobble something up if you restricted the word to always return objects of the same type. Hardly a liveable restriction in my book. Active message names are not much better. You cannot have a word which returns a message. That is a somewhat esoteric thing to do in most OO systems, but it does allow for message names to be passed as parameters to other messages, esp. to the message 'RespondsTo' which will tell you if the object can respond to the given message. I also dislike the necessity of doing message sends from the "inside out": PushArg PushArg Object Message I say "inside out" because in traditional OO systems, say SmallTalk, the syntax is: Object Message Arg Arg ... so the "inside out" syntax is neither "prefix" nor "post fix" but inside out. The SmallTalk syntax works nicely for both nesting and cascading. Since Forth is post-fix, I think that the syntax should be: PushArg PushArg Message Object That looks ok, but it does not do anything. In order to do something you would have to add a special word. I would pick SEND, as in: 10 20 MoveTo MyRectangle SEND the nice thing about having an explicit send is that you can replace MoveTo and/or MyRectangle with arbitrary Forth code and still have it work. This is not stuff that I've thought hard about for a long time, nor have I implemented and played with to get at its practicality. I would appreciate feedback. I would also like to hear defenses for the active systems. Perhaps I have overlooked or misunderstood something. -Doug --- Preferred: ( dwp@willett.pgh.pa.us OR ...!{sei,pitt}!willett!dwp ) Daily: ...!{uunet,nfsun}!willett!dwp [last resort: dwp@vega.fac.cs.cmu.edu]