Path: utzoo!attcan!uunet!mcsun!ukc!newcastle.ac.uk!rigg!njkw From: J.K.Wight@newcastle.ac.uk (Jim Wight) Newsgroups: comp.lang.lisp.x Subject: How are superclass methods invoked? Message-ID: <1990Jul6.145808.22466@newcastle.ac.uk> Date: 6 Jul 90 14:58:08 GMT Sender: news@newcastle.ac.uk Organization: Computing Laboratory, U of Newcastle upon Tyne, UK NE17RU Lines: 43 I am relatively new to OOP and xlisp and am having some difficulty getting to grips with the combination as the documentation is either misleading or doesn't explain things in sufficient detail to match my naivety. For instance, the documentation states that:- "A message can also be sent from the body of a method by using the current object, but the method lookup starts with the object's superclass rather than its class." I understand this to mean that if class1 is derived from Object, and class2 from class1, and if each class has a method :whatever, say, then class2's :whatever can include the expression (send self :whatever) in order to invoke class1's :whatever. But this is not what happens. I find that class2's :whatever recursively calls itself. Is this a bug in the documentation or a bug in xlisp? Also, what is :sendsuper all about and how is it used? It doesn't appear to be a method of Object like :show or :class, which means that I have to provide one through (send class2 :answer :sendsuper ...). My difficulty is that I don't see what to put in its body. If I am able to send a message to the superclass from within the class's :sendsuper method then what does :sendsuper gain me? Because of what was said in the previous paragraph it can't include (send self :whatever ...) unless class2 doesn't have a :whatever method, in which case I might as well just say (send object2 :whatever) directly since class1's :whatever method will be found through inheritance anyway (object2 is an instance of class2). I've obviously completely missed the point somewhere along the line, so I would be grateful if someone would put me right. A simple example of the use of :sendsuper would be appreciated. I am using Version 2.0. If there is a more recent one could someone provide the name of an ftp site. Jim --- Computing Laboratory VOICE: +44 91 222 8238 FAX: +44 91 222 8232 University of Newcastle upon Tyne JANET: J.K.Wight@uk.ac.newcastle Newcastle upon Tyne UUCP: ...!ukc!newcastle.ac.uk!J.K.Wight NE1 7RU, UK ARPA: J.K.Wight%uk.ac.newcastle@nsfnet-relay.ac.uk