Advertisement

Efficient Multimethods in a Single Dispatch Language

  • Brian Foote
  • Ralph E. Johnson
  • James Noble
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3586)

Abstract

Smalltalk-80 is a pure object-oriented language in which messages are dispatched according to the class of the receiver, or first argument, of a message. Object-oriented languages that support multimethods dispatch messages using all their arguments. While Smalltalk does not support multimethods, Smalltalk’s reflective facilities allow programmers to efficiently add them to the language. This paper explores several ways in which this can be done, and the relative efficiency of each. Moreover, this paper can be seen as a lens through which the design issues raised by multimethods, as well as by using metaobjects to build them, can be more closely examined.

Keywords

Virtual Machine Language Design Graphical Object Multiple Inheritance Visitor Pattern 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. [Benoit 1986]
    Benoit, C., Caseau, Y., Pherivong, C.: Knowledge Representation and Communication Mechanisms in Lore. In: ECAI 1986, pp. 215–224 (1986)Google Scholar
  2. [Blake & Cook 1987]
    Blake, D., Cook, S.: On Including Part Hierarchies in Object-Oriented Languages, with an Implementation in Smalltalk. In: Gjessing, S., Nygaard, K. (eds.) ECOOP 1988. LNCS, vol. 322, pp. 41–50. Springer, Heidelberg (1988)CrossRefGoogle Scholar
  3. [Bobrow 1983]
    Bobrow, D.G.: The LOOPS Manual. Xerox Parc. (1983)Google Scholar
  4. [Bobrow 1986]
    Bobrow, D.G., Kahn, K., Kiczales, G., Masinter, L., Stefik, M., Zdybel, F.: CommonLoops: Merging Lisp and Object-Oriented Programming. In: OOPSLA Proceedings (1986)Google Scholar
  5. [Bobrow 1988a]
    Bobrow, D.G., DeMichiel, L.G., Gabriel, R.P., Keene, S.E., Kiczales, G., Moon, D.A.: Common Lisp Object System Specification X3J13. In: SIGPLAN Notices, September 1988, vol. 23 (1988)Google Scholar
  6. [Bobrow 1988b]
    Bobrow, D.G., Kiczales, G.: The Common Lisp Object System Metaobject Kernel – A Status Report. In: Proceedings of the 1988 Conference on Lisp and Functional Programming (1988)Google Scholar
  7. [Bobrow 1993]
    Bobrow, D.G., Gabriel, R.P., White, J.L.: CLOS in Context: The Shape of the Design Space. In: Paepcke, A. (ed.) Object-Oriented Programming: The CLOS Perspective. MIT Press, Cambridge (1993). http://www.dreamsongs.com/NewFiles/clos-book.pdf Google Scholar
  8. [Borning & O’Shea, 1987]
    Borning, A., O’Shea, T.: Deltatalk: An Empirically and Aesthetically Motivated Simplification of the Smalltalk-80 Language. In: Bézivin, J., Hullot, J.-M., Lieberman, H., Cointe, P. (eds.) ECOOP 1987. LNCS, vol. 276, pp. 3–12. Springer, Heidelberg (1987)CrossRefGoogle Scholar
  9. [Borning & Ingalls 1982]
    Borning, A.H., Ingalls, D.H.H.: A Type Declaration and Inference System for Smalltalk. In: POPL Proceedings, pp. 133–141 (1982)Google Scholar
  10. [Boyland & Castagna 1997]
    Boyland, J., Castagna, G.: Parasitic Methods: An Implementation of Multi Methods for Java. In: OOPSLA Proceedings (1997)Google Scholar
  11. [Bracha 2004]
    Bracha, G., Ungar, D.: Mirrors: design principles for meta-level facilities of object-oriented programming languages. In: OOPSLA Proceedings, pp. 331–344 (2004)Google Scholar
  12. [Brant 1998]
    Brant, J., Foote, B., Roberts, D., Johnson, R.: Wrappers to the Rescue. In: Jul, E. (ed.) ECOOP 1998. LNCS, vol. 1445, p. 396. Springer, Heidelberg (1998)CrossRefGoogle Scholar
  13. [Bruce 1995]
    Bruce, K., Cardelli, L., Castagna, G., Leavens, G.T., Pierce, B.: On binary methods. Theory and Practice of Object Systems 1(3), 221–242 (1995)Google Scholar
  14. [Caseau 1986]
    Caseau, Y.: An Overview of Lore. IEEE Software 3(1), 72–73 Google Scholar
  15. [Caseau 1989]
    Caseau, Y.: A Model for a Reflective Object-Oriented Language. SIGPLAN Notices 24(4), 22–24 Google Scholar
  16. [Castagna 1995]
    Castagna, G.: Covariance and contravariance: Conflict without a cause. ACM Transactions on Programming Languages and Systems 17(3), 431–447 (1995)CrossRefGoogle Scholar
  17. [Chambers 1992]
    Chambers, C.: Object-Oriented Multimethods in Cecil. In: Lehrmann Madsen, O. (ed.) ECOOP 1992. LNCS, vol. 615, pp. 33–56. Springer, Heidelberg (1992)CrossRefGoogle Scholar
  18. [Clifton 2000]
    Clifton, C., Leavens, G.T., Chambers, C., Millstein, T.: Proceedings of OOPSLA 2000. In: Proceedings of OOPSLA 2000, pp. 130–145 (2000)Google Scholar
  19. [Czarnecki 2000]
    Czarnecki, K., Eisenecker, U.W.: Generative Programming: Methods, Tools, and Applications. Addison-Wesley, Reading (2000)Google Scholar
  20. [Deutsch 1984]
    Deutsch, L.P., Schiffman, A.M.: Efficient Implementation of the Smalltalk-80 System. In: Proceedings of the Tenth Annual ACM Symposiumon Principles of Programming Languages, pp. 297–302 (1983)Google Scholar
  21. [Feinberg 1996]
    Feinberg, N., Keene, S.E., Mathews, R.O., Washington, P.T.: The Dylan Programming Book. Addison-Wesley Longman, Amsterdam (1996)Google Scholar
  22. [Foote & Johnson 1989]
    Foote, B., Johnson, R.E.: Reflective Facilities in Smalltalk-80. In: OOPSLA 1989 Proceedings, pp. 327–335 (1989)Google Scholar
  23. [Foote & Yoder 1998]
    Metadata. In: Proceedings of the Fifith Conference on Pattern Languages of Programs (PLoP 1998) Monticello, Illinois, Technical Report #WUCS-98025 (PLoP 1998/EuroPLoP 1998) Dept. of Computer Science, Washington University (August 1998)Google Scholar
  24. [Foote 2000]
    Foote, B., Yoder, J.W.: Big Ball of Mud. In: Harrison, N., et al. (eds.) Patterns Languages of Program Design 4 (PLoPD4). Addison-Wesley, Reading (2000)Google Scholar
  25. [Gabriel 1991]
    Gabriel, R.P., White, J.L., Bobrow, D.G.: CLOS: Integrating Object-Oriented and Functional Programming. Communications of the ACM 34 (1991)Google Scholar
  26. [Gamma 1995]
    Gamma, E., Helm, R., Johnson, R.E., Vlissides, J.: Design Patterns: Elements of Reusable Object-Oriented Software. Addision-Wesley, Reading (1995)Google Scholar
  27. [Grothoff 2003]
    Grothoff, C.: Walkabout revisited: The runabout. In: Cardelli, L. (ed.) ECOOP 2003. LNCS, vol. 2743. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  28. [Goldberg 1976]
    Goldberg, A., Kay, A. (eds.): with the Learning Research Group. Smalltalk-72 Instruction Manual. Xerox Palo Alto Research Center, Google Scholar
  29. [Goldberg 1983]
    Goldberg, A., Robson, D.: Smalltalk-80: The Language and its Implementation. Addison-Wesley, Reading (1983)zbMATHGoogle Scholar
  30. [Goldberg 1984]
    Goldberg, A.: Smalltalk-80: The Interactive Programming Environment. Addison-Wesley, Reading (1984)zbMATHGoogle Scholar
  31. [Goldberg 2004]
    Goldberg, D.S., Findler, R.B., Flatt, M.: Super and inner: together at last! In: OOPSLA Proceedings 2004, pp. 116–129 (2004)Google Scholar
  32. [Hebel 1990]
    Hebel, K.J., Johnson, R.E.: Arithmetic and Double Dispatching in Smalltalk-80. Journal of Object-Oriented Programming 2(6), 40–44 (1990)Google Scholar
  33. [Ingalls 1978]
    Daniel, H., Ingalls., H.: The Smalltalk-76 Programming System: Design and Implementation. In: 5th ACM Symposium on POPL, pp. 9–15 (1978)Google Scholar
  34. [Ingalls 1986]
    Ingalls, D.H.H.: A simple technique for handling multiple polymorphism. In: Proceedings of OOPSLA 1986 (1986)Google Scholar
  35. [Johnson 1988b]
    Johnson, R.E., Graver, J.O., Zurawski, L.W.: TS: An Optimizing Compiler for Smalltalk. In: OOPSLA 1988 Proceedings, pp. 18–26 (1988)Google Scholar
  36. [Kiczales & Rodriguez 1990]
    Kiczales, G., Rodriguez, L.: Efficient Method Dispatch in PCL. In: Proceedings of the ACM Conference on Lisp and Functional Programming, pp. 99–105 (1990)Google Scholar
  37. [Kiczales 1991]
    Kiczales, G., Rivieres, J.d., Bobrow, D.G.: The Art of the Metaobject Protocol. MIT Press, Cambridge (1991)Google Scholar
  38. [Kiczales 2001]
    Kiczales, G., Hilsdale, E., Hugunin, J., Kersten, M., Palm, J., Griswold, W.G.: An overview of AspectJ. In: Knudsen, J.L. (ed.) ECOOP 2001. LNCS, vol. 2072, p. 327. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  39. [Keene 1989]
    Keene, S.E.: Object-Oriented Programming in Common Lisp: A Programmer’s Introduction to CLOS. Addison-Wesley, Reading (1989)zbMATHGoogle Scholar
  40. [Krasner 1983]
    Krasner, G. (ed.): Smalltalk 80: Bits of History, Words of Advice. Addison-Wesley, Reading (1983)zbMATHGoogle Scholar
  41. [Kristensen 1990]
    Kristensen, B.B., Madsen, O.L., Moller-Pedersen, B., Nygaard, K.: Object-Oriented Programming in the Beta Language (1990)Google Scholar
  42. [LaLonde 1986]
    LaLonde, W.R., Thomas, D.A., Pugh, J.R.: An Exemplar Based Smalltalk. In: OOPSLA 1986 Proceedings, Portland, OR, October 4-8, pp. 322–330 (1977)Google Scholar
  43. [Leavens and Millstein]
    Multiple Dispatch as Dispatch on Tuples. In: OOPSLA Proceedings, pp. 274–287 (1998)Google Scholar
  44. [McAffer 1995]
    McAffer, J.: Meta-level Programming with CodA. In: Olthoff, W. (ed.) ECOOP 1995. LNCS, vol. 952, pp. 190–214. Springer, Heidelberg (1995)Google Scholar
  45. [Maes 1987a]
    Maes, P.: Computational Reflection. Artificial Intelligence Laboratory. Vrije Universiteit Brussel. Technical Report 87-2 (1987)Google Scholar
  46. [Maes 1987b]
    Maes, P.: Concepts and Experiments in Computational Reflection. In: OOPSLA 1987 Proceedings, pp. 147–155 (1987)Google Scholar
  47. [Moon 1986]
    Moon, D.: Object-Oriented Programming with Flavors. In: OOPSLA 1986 Proceedings, pp. 1–8 (1986)Google Scholar
  48. [Mougin 2003]
    Mougin, P., Ducasse, S.: OOPAL: integrating array programming in object-oriented programming. In: OOPSLA Proceedings, pp. 65–77 (2003)Google Scholar
  49. [Mugridge 1991]
    Mugridge, W., Hamer, J., Hosking, J.: Multi-Methods in a StaticallyTyped Programming Language. In: America, P. (ed.) ECOOP 1991. LNCS, vol. 512, pp. 147–155. Springer, Heidelberg (1991)CrossRefGoogle Scholar
  50. [Paepcke 1993]
    Paepcke, A. (ed.): Object-Oriented Programming: The CLOS Perspective. MIT Press, Cambridge (1993)Google Scholar
  51. [Palsberg 1998]
    Palsberg, J., Jay, C.B., Noble, J.: Experiments with Generic Visitors. In: The Proceedings of theWorkshop on Generic Programming, Marstrand, Sweden (1998)Google Scholar
  52. [Palsberg 2004]
    Palsberg, J., Drunen, J.V.: Visitor oriented programming. In: The Workshop for Foundations of Object-Oriented Programming, FOOL (2004)Google Scholar
  53. [Rivard 1997]
    F. Rivard. Evolution du comportement des objets dans les langages a classes reflexifs. PhD thesis, Ecole des Mines de Nantes, France (June 1997)Google Scholar
  54. [Saltzer 1981]
    Saltzer, J.H., Reed, D.P., Clark, D.D.: End-to-end arguments in system design. In: Second International Conference on Distributed Computing Systems, April, pp. 509–512 (1981)Google Scholar
  55. [Scharli 2004]
    Schärli, N., Black, A.P., Ducasse, S.: Object-oriented encapsulation for dynamically typed languages. In: OOPSLA Proceedings, pp. 130–149 (2004)Google Scholar
  56. [Smith 1983]
    Smith, B.C.: Reflection and Semantics in Lisp. In: POPL Proceedings, pp. 23–35 (1984)Google Scholar
  57. [Stefik 1986a]
    Stefik, M., Bobrow, D.G.: Object-Oriented Programming: Themes and Variations. AI Magazine 6(4), 40–62 (1986)Google Scholar
  58. [Stroustrup 1986]
    Bjarne Stroustrup.The C++ Programming Language. Addison-Wesley, Reading (1986)Google Scholar
  59. [Thorup 1997]
    Thorup, K.K.: Genericity in Java with virtual types. In: Aksit, M., Matsuoka, S. (eds.) ECOOP 1997. LNCS, vol. 1241, pp. 444–471. Springer, Heidelberg (1997)CrossRefGoogle Scholar
  60. [Ungar 1987]
    Ungar, D., Smith, R.B.: Self: The Power of Simplicity. In: OOPSLA 1987 Proceedings, pp. 227–242 (1987)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2005

Authors and Affiliations

  • Brian Foote
    • 1
  • Ralph E. Johnson
    • 1
  • James Noble
    • 2
  1. 1.Dept. of Computer ScienceUniversity of Illinois at Urbana-ChampaignUrbanaUSA
  2. 2.School of Mathematical and Computing SciencesVictoria University of WellingtonWellingtonNew Zealand

Personalised recommendations