Advertisement

Scheme with Classes, Mixins, and Traits

  • Matthew Flatt
  • Robert Bruce Findler
  • Matthias Felleisen
Part of the Lecture Notes in Computer Science book series (LNCS, volume 4279)

Abstract

The Scheme language report advocates language design as the composition of a small set of orthogonal constructs, instead of a large accumulation of features. In this paper, we demonstrate how such a design scales with the addition of a class system to Scheme. Specifically, the PLT Scheme class system is a collection of orthogonal linguistic constructs for creating classes in arbitrary lexical scopes and for manipulating them as first-class values. Due to the smooth integration of classes and the core language, programmers can express mixins and traits, two major recent innovations in the object-oriented world. The class system is implemented as a macro in terms of procedures and a record-type generator; the mixin and trait patterns, in turn, are naturally codified as macros over the class system.

Keywords

Class System Method Call Multiple Inheritance Initialization Argument Method Declaration 
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. 1.
    Abelson, H., Sussman, G.J.: Structure and Interpretation of Computer Programs. MIT Press, Cambridge (1984)Google Scholar
  2. 2.
    Adams, N., Rees, J.: Object-oriented programming in Scheme. In: Proc. ACM Conference on Lisp and Functional Programming, pp. 277–288 (1988)Google Scholar
  3. 3.
    Allen, E., Chase, D., Luchangco, V., Maessen, J.-W., Ryu, S., Steek Jr., G.L., Tobin-Hochstadt, S.: The Fortress language specification (2006)Google Scholar
  4. 4.
    Ancona, D., Lagorio, G., Zucca, E.: Jam -designinga Java extension with mixins. ACM Transactions on Computing Systems 25, 641–712 (2003)Google Scholar
  5. 5.
    Ancona, D., Zucca, E.: An algebraic approach to mixins and modularity. In: Hanus, M., Rodríguez-Artalejo, M. (eds.) ALP 1996. LNCS, vol. 1139, pp. 179–193. Springer, Heidelberg (1996)Google Scholar
  6. 6.
    Ancona, D., Zucca, E.: Aprimitive calculus for module systems. In: Nadathur, G. (ed.) PPDP 1999. LNCS, vol. 1702, pp. 62–79. Springer, Heidelberg (1999)CrossRefGoogle Scholar
  7. 7.
    Barzilay, E.: Swindle (2002), http://www.barzilay.org/Swindle/
  8. 8.
    Benson Jr., Brent, W.: libscheme: Scheme as a C library. In: Proc. USENIX Symposium on Very High Level Languages (1994)Google Scholar
  9. 9.
    Black, A.P., Schärli, N., Ducasse, S.: Applying traits to the Smalltalk collection hierarchy. In: Proc. ACM Conference on Object-Oriented Programming, Systems, Languages, and Applications, pp. 47–64 (October 2003)Google Scholar
  10. 10.
    Bracha, G.: The Programming Language Jigsaw: Mixins, Modularity and Multiple Inheritance. Ph.D. thesis, Dept. of Computer Science, University of Utah (March 1992)Google Scholar
  11. 11.
    Bracha, G., Cook, W.: Mixin-based inheritance. In: Proc. Joint ACM Conf. on Object-Oriented Programming, Systems, Languages and Applications and the European Conference on Object-Oriented Programming (October 1990)Google Scholar
  12. 12.
    Dybvig, R.K., Hieb, R., Bruggeman, C.: Syntactic abstraction in Scheme. Lisp and Symbolic Computation 5(4), 295–326 (1993)CrossRefGoogle Scholar
  13. 13.
    Findler, R.B., Flanagan, C., Flatt, M., Krishnamurthi, S., Felleisen, M.: DrScheme: A pedagogic programming environment for Scheme. In: Hartel, P.H., Kuchen, H. (eds.) PLILP 1997. LNCS, vol. 1292, pp. 369–388. Springer, Heidelberg (1997)CrossRefGoogle Scholar
  14. 14.
    Fisherand, K., Reppy, J.: A typed calculus of traits. In: Proc. ACM International Workshop on Foundations of Object-Oriented Languages (2004)Google Scholar
  15. 15.
    Flatt, M.: Compilable and composable macros. In: Proc. ACM International Conference on Functional Programming (October 2002)Google Scholar
  16. 16.
    Flatt, M., Felleisen, M.: Units: Cool modules for HOT languages. In: Proc. ACM Conference on Programming Language Design and Implementation, pp. 236–248 (June 1998)Google Scholar
  17. 17.
    Flatt, M., Krishnamurthi, S., Felleisen, M.: Classes and mixins. In: Proc. ACM Symposium on Principles of Programming Languages, pp. 171–183 (January 1998)Google Scholar
  18. 18.
    Friedman, D.P.: Object-oriented style (invited talk). In: International LISP Conference (2003)Google Scholar
  19. 19.
    Goldberg, D., Findler, R.B., Flatt, M.: Super and inner — together at last! In: Proc. ACM Conference on Object-Oriented Programming, Systems, Languages, and Applications, pp. 116–129 (October 2004)Google Scholar
  20. 20.
    Kelsey, R., Clinger, W., Rees, J. (eds.): The revised 5 report on the algorithmic language Scheme. ACM SIGPLAN Notices, vol. 33(9) (September 2004)Google Scholar
  21. 21.
    Lamping, J.: Typing the specialization interface. In: Proc. ACM Conference on Object-Oriented Programming, Systems, Languages, and Applications, pp. 201–214 (1993)Google Scholar
  22. 22.
    Lehrmann Madsen, O., Møller-Pedersen, B., Nygaard, K.: Object-oriented programming in the BETA programming language. ACM Press/Addison-Wesley (1993)Google Scholar
  23. 23.
    Moon, D.A.: Object-oriented programming with Flavors. In: Proc. ACM Conference on Object-Oriented Programming, Systems, Languages, and Applications, pp. 1–8 (November 1986)Google Scholar
  24. 24.
    Oderskyand, M., Zenger, M.: Scalable component abstractions. In: Proc. ACM Conference on Object-Oriented Programming, Systems, Languages, and Applications, pp. 41–57 (2005)Google Scholar
  25. 25.
    PLT Scheme (2006), http://www.plt-scheme.org
  26. 26.
    Queinnec, C.: Meroon V3: A Small, Efficient, and Enhanced Object System (1997)Google Scholar
  27. 27.
    Reppy, J., Turon, A.: A foundation for trait-based metaprogramming. In: Proc. ACM International Workshop on Foundations of Object-Oriented Languages (2006)Google Scholar
  28. 28.
    Schärli, N.: Composing Classes from Behavioral Building Blocks. PhD thesis, University of Berne (2002)Google Scholar
  29. 29.
    Schärli, N., Ducasse, S., Nierstrasz, O., Black, A.P.: Traits: Composable units of behaviour. In: Cardelli, L. (ed.) ECOOP 2003. LNCS, vol. 2743, pp. 248–274. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  30. 30.
    Smaragdakis, Y., Batory, D.: Implementing layered designs with mixin layers. In: Jul, E. (ed.) ECOOP 1998. LNCS, vol. 1445, pp. 550–570. Springer, Heidelberg (1998)CrossRefGoogle Scholar
  31. 31.
    Smart, J., et al.: wxWindows, http://web.ukonline.co.uk/julian.smart/wxwin/

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • Matthew Flatt
    • 1
  • Robert Bruce Findler
    • 2
  • Matthias Felleisen
    • 3
  1. 1.University of Utah 
  2. 2.University of Chicago 
  3. 3.Northeastern University 

Personalised recommendations