Skip to main content

Scheme with Classes, Mixins, and Traits

  • Conference paper

Part of the Lecture Notes in Computer Science book series (LNPSE,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.

This is a preview of subscription content, access via your institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (Canada)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (Canada)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.99
Price excludes VAT (Canada)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Abelson, H., Sussman, G.J.: Structure and Interpretation of Computer Programs. MIT Press, Cambridge (1984)

    Google Scholar 

  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. 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. Ancona, D., Lagorio, G., Zucca, E.: Jam -designinga Java extension with mixins. ACM Transactions on Computing Systems 25, 641–712 (2003)

    Google Scholar 

  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. Ancona, D., Zucca, E.: Aprimitive calculus for module systems. In: Nadathur, G. (ed.) PPDP 1999. LNCS, vol. 1702, pp. 62–79. Springer, Heidelberg (1999)

    CrossRef  Google Scholar 

  7. Barzilay, E.: Swindle (2002), http://www.barzilay.org/Swindle/

  8. Benson Jr., Brent, W.: libscheme: Scheme as a C library. In: Proc. USENIX Symposium on Very High Level Languages (1994)

    Google Scholar 

  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. 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. 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. Dybvig, R.K., Hieb, R., Bruggeman, C.: Syntactic abstraction in Scheme. Lisp and Symbolic Computation 5(4), 295–326 (1993)

    CrossRef  Google Scholar 

  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)

    CrossRef  Google Scholar 

  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. Flatt, M.: Compilable and composable macros. In: Proc. ACM International Conference on Functional Programming (October 2002)

    Google Scholar 

  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. 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. Friedman, D.P.: Object-oriented style (invited talk). In: International LISP Conference (2003)

    Google Scholar 

  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. 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. 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. 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. 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. 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. PLT Scheme (2006), http://www.plt-scheme.org

  26. Queinnec, C.: Meroon V3: A Small, Efficient, and Enhanced Object System (1997)

    Google Scholar 

  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. Schärli, N.: Composing Classes from Behavioral Building Blocks. PhD thesis, University of Berne (2002)

    Google Scholar 

  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)

    CrossRef  Google Scholar 

  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)

    CrossRef  Google Scholar 

  31. Smart, J., et al.: wxWindows, http://web.ukonline.co.uk/julian.smart/wxwin/

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and Permissions

Copyright information

© 2006 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Flatt, M., Findler, R.B., Felleisen, M. (2006). Scheme with Classes, Mixins, and Traits. In: Kobayashi, N. (eds) Programming Languages and Systems. APLAS 2006. Lecture Notes in Computer Science, vol 4279. Springer, Berlin, Heidelberg. https://doi.org/10.1007/11924661_17

Download citation

  • DOI: https://doi.org/10.1007/11924661_17

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-48937-5

  • Online ISBN: 978-3-540-48938-2

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics