Path: utzoo!utgpu!watserv1!watmath!att!rutgers!usc!zaphod.mps.ohio-state.edu!van-bc!ubc-cs!news-server.csri.toronto.edu!helios.physics.utoronto.ca!ists!gkcl!peterc From: peterc@gkcl.ists.ca (Peter Camilleri) Newsgroups: comp.lang.forth Subject: Re: Object-oriented Forth Message-ID: <12070@ists.ists.ca> Date: 1 Sep 90 13:14:54 GMT References: <29113@nigel.ee.udel.edu> Sender: news@ists.ists.ca Reply-To: peterc@gkcl.UUCP (Peter Camilleri) Organization: y Lines: 63 In article <29113@nigel.ee.udel.edu> carroll@udel.edu (Mark C. Carroll ) writes: > > >1> What exactly do we mean by object-orientation? >2> What form of object-orientation is best-suited to Forth? >3> What syntax is most natural for this form? > >To me, object-orientation is a model of computation where the objects >are active and the operations passive. This doesn't sound like much >right now, but I think it's a very important thing to remember when it >comes time to design a syntax. > To me, an object oriented system must exhibit the following properties: late binding polymorphism type checking (if any) at RUN TIME! the encapsulation of code and data into things called "OBJECTS" the hiding of private information contained within an "OBJECT" inheretance of object class behaviour >What form of object-orientation is most well-suited to Forth? This is >a much more difficult question. It helps to consider the models that >are available. In my opinion, there are four primary models of >object-orientation: [1] Loosely-typed class (Smalltalk), [2] Strongly >typed class (C++, Eiffel), [3] Prototyped (Self), and [4] Law Governed >Systems (Darwin). > >I think that we can immediately eliminate [2] (Forth has never had >strong declared typing, so it would be unnatural to add it for OO), >and [4] (Forth has always been very minimal - a Law Enforcement system >in the message pass mechanism would be very unforthlike). > I am familiar with [1] and [2] by direct experience. Could you elaborate on [3] and [4] a bit? I would favour [1] because of its simplicity and effectiveness in problem solving. It woukd be a good idea to avoid the rabid complexity of c++ with its multiple inheritance, multi-object tree and trying to avoid the issue that classes themselves should be treated as first class objects. (I have used both Smalltalk and C++ extensively, can you guess which I prefer? :-) [discussion of syntax deleted, I tend to agree overall.] >Now, the important question is what kind of syntax to use for actual >object creation. This, I'm very uncertain of. I would like to see what >some other folks think about an appropritae syntax before I make any >decision of what I like best. > In the same manner as Smalltalk, I feel that classes should be objects. They would be responsable for creating new objects, hold class wide data, and performing other "objectless" processing. The classes would be instances of the class MetaClass, which would be pre-existing. In the spirit of FORTH, MetaClass could be subclassed to allow new classes to be created in different ways. (Not too unlike a defining defining word) >Go ahead, rip me apart. > The above probably applies to me more than to you. Apology #1 - I flunked grade six spelling, so no spelling flames please! Peter Camilleri peterc@stpl.UUCP 1543 Marshcourt Drive uunet!mnetor!yunexus!stpl!peterc Pickering, Ont L1V-6C8