skip to main content
10.1145/2637647.2637654acmotherconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
research-article

Towards virtual traits in Scala

Published: 28 July 2014 Publication History

Abstract

Scala is a powerful language that supports a variety of features, but it lacks virtual traits. Virtual traits are class-valued object attributes and can be redefined within subtraits. They support higher-order hierarchies and family polymorphism. This work introduces virtual traits into Scala and explains how to encode virtual traits on top of existing Scala features. We have implemented this encoding using Scala annotation macros and have conducted two small case studies.

References

[1]
Martin Odersky and Matthias Zenger. "Scalable Component Abstractions". In: OOPSLA. ACM, 2005, pp. 41--57.
[2]
Erik Ernst. "The expression problem, Scandinavian style". In: ON MECHANISMS FOR SPECIALIZATION (2004), p. 27.
[3]
Vaidas Gasiunas and Ivica Aracic. "Dungeon: A Case Study of Feature-Oriented Programming with Virtual Classes". In: Proceedings of the 2nd Workshop on Aspect-Oriented Product Line Engineering. Oct. 2007.
[4]
Erik Ernst, Klaus Ostermann, and William R. Cook. "A Virtual Class Calculus". In: SIGPLAN Not. 41.1 (2006).
[5]
Eugene Burmako."Scala Macros: Let Our Powers Combine!: On How Rich Syntax and Static Types Work with Metaprogramming". In: SCALA '13. ACM, 2013, 3:1--3:10.
[6]
The Scala Language Specification Version 2.9. url: http://www.scala-lang.org/files/archive/nightly/pdfs/ScalaReference.pdf.
[7]
Manuel Weiel. Virtual classes for Scala implemented as annotation macro. url: https://github.com/xmanu/scala-virtual-classes-annotation-macros.
[8]
O. L. Madsen and B. Moller-Pedersen."Virtual Classes: A Powerful Mechanism in Object-oriented Programming". In: SIGPLAN Not. 24.10 (1989).
[9]
Bent Bruun Kristensen, Ole Lehrmann Madsen, Birger Møller-Pedersen, and Kristen Nygaard. "The BETA programming language". In: DAIMI Report Series 16 (1987).
[10]
Erik Ernst. "gbeta-a language with virtual attributes, Block Structure, and Propagating, Dynamic Inheritance". In: DAIMI Report Series 29.549 (2000).
[11]
Ivica Aracic, Vaidas Gasiunas, Mira Mezini, and Klaus Ostermann. "An Overview of CaesarJ". In: Transactions on Aspect-Oriented Software Development I. Lecture Notes in Computer Science. Springer Berlin Heidelberg, 2006, pp. 135--173.
[12]
CaesarJ language specification. url:http://www.caesarj.org/index.php/CJLS/Classes.
[13]
Dave Clarke, Sophia Drossopoulou, James Noble, and Tobias Wrigstad. "Tribe: a simple virtual class calculus". In: Proceedings of the 6th international conference on Aspect-oriented software development. ACM. 2007, pp. 121--134.

Cited By

View all
  • (2017)Familia: unifying interfaces, type classes, and family polymorphismProceedings of the ACM on Programming Languages10.1145/31338941:OOPSLA(1-31)Online publication date: 12-Oct-2017

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Other conferences
SCALA '14: Proceedings of the Fifth Annual Scala Workshop
July 2014
75 pages
ISBN:9781450328685
DOI:10.1145/2637647
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

  • Uppsala University, Department of Information Science: Uppsala University, Department of Information Science
  • AITO: Assoc Internationale por les Technologies Objects

In-Cooperation

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 28 July 2014

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. family polymorphism
  2. macros
  3. virtual classes
  4. virtual traits

Qualifiers

  • Research-article

Conference

ECOOP '14
Sponsor:
  • Uppsala University, Department of Information Science
  • AITO

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)2
  • Downloads (Last 6 weeks)1
Reflects downloads up to 27 Feb 2025

Other Metrics

Citations

Cited By

View all
  • (2017)Familia: unifying interfaces, type classes, and family polymorphismProceedings of the ACM on Programming Languages10.1145/31338941:OOPSLA(1-31)Online publication date: 12-Oct-2017

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media