peskin@caip.rutgers.edu (R. L. Peskin) (01/12/90)
I need to be able to start method searches at levels higher than "self super". That is, if we had the following heirarchy: Class1 | Class2 | Class3 "self super" in one of Class3's methods would initiate method search in Class2. How can I initiate the search in Class1 (from one of Class3's methods)? Thanks, --dick peskin %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Richard L. Peskin CAIP Parallel Computing Lab CAIP Center CN - 1390 Rutgers University Piscataway, N. J. 08855-1390 net: peskin@caip.rutgers.edu %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
peter@celia.UUCP (Peter Farson) (01/12/90)
In article <Jan.11.13.41.59.1990.21671@caip.rutgers.edu> peskin@caip.rutgers.edu (R. L. Peskin) writes: >I need to be able to start method searches at levels higher than "self super". >That is, if we had the following heirarchy: > >Class1 > | >Class2 > | >Class3 > >"self super" in one of Class3's methods would initiate method search in Class2. >How can I initiate the search in Class1 (from one of Class3's methods)? > >Thanks, > Here's a polymorphic solution. If your message selector is "doit", have a "self asClass1 doit" in your method in Class3. This requires the existence of the method with the selector "asClass1" that would make an instance of Class1 from your instance of Class3. This is a bit more overhead than just a message search. Another solution that's probably faster (because it doesn't involve the creation of new objects) but less elegant is to create a new method in the child class of the class that you want the searching to begin in. For instance, have a method with selector "doit2" in Class2 with the method "super doit". Then your "doit" method in Class3 can do a "self doit2". -- The flesh of animals who feed | Peter Farson - Rhythm & Hues, Inc. excursively is allowed to have | celia!peter@usc.edu a higher flavour than that of | celia!peter@tis.llnl.gov those who are cooped up. - Samuel Johnson |