skip to main content
10.1145/3241653.3241661acmconferencesArticle/Chapter ViewAbstractPublication PagespldiConference Proceedingsconference-collections
research-article

Extending Scala with records: design, implementation, and evaluation

Published: 17 September 2018 Publication History

Abstract

This paper presents a design for extensible records in Scala satisfying design goals such as structural subtyping, typesafe polymorphic operations, and separate compilation without runtime bytecode generation. Using new features of Scala 3, the design requires only minimal, local changes to the Scala 3 reference compiler Dotty as well as a small library component. Runtime performance is evaluated experimentally using a novel benchmarking suite generator, showing that the design is competitive with Scala 2's cached reflection for structural field access, and excels at immutable extension and update operations.

References

[1]
Bowen Alpern, Anthony Cocchi, Stephen Fink, and David Grove. 2001. Efficient Implementation of Java Interfaces: Invokeinterface Considered Harmless. In Proceedings of the 16th ACM SIGPLAN Conference on Object-oriented Programming, Systems, Languages, and Applications (OOPSLA'01). ACM, New York, NY, USA, 108-124.
[2]
Luca Cardelli and John C Mitchell. 1991. Operations on records. Mathematical structures in computer science 1, 1 (1991), 3-48.
[3]
Gilles Dubochet and Martin Odersky. 2009. Compiling structural types on the JVM: a comparison of reflective and generative techniques from Scala's perspective. In Proceedings of the 4th Workshop on the Implementation, Compilation, Optimization of Object-Oriented Languages and Programming Systems (ICOOOLPS '09). ACM, New York, NY, USA, 34-41.
[4]
Benedict R. Gaster and Mark P. Jones. 1996. A Polymorphic Type System for Extensible Records and Variants. Technical Report NOTTCS-TR-96-3. Department of Computer Science, University of Nottingham.
[5]
Andy Georges, Dries Buytaert, and Lieven Eeckhout. 2007. Statistically Rigorous Java Performance Evaluation. In Proceedings of the 22Nd Annual ACM SIGPLAN Conference on Object-oriented Programming Systems and Applications (OOPSLA '07). ACM, New York, NY, USA, 57-76.
[6]
Joseph Gil and Itay Maman. 2008. Whiteoak: Introducing Structural Typing into Java. In Proceedings of the 23rd ACM SIGPLAN Conference on Object-oriented Programming Systems Languages and Applications (OOPSLA'08). ACM, New York, NY, USA, 73-90.
[7]
Vojin Jovanovic, Tobias Schlatter, Hubert Plocziniczak, et al. 2014-2018. scala-records, Labeled records for Scala based on structural refinement types and macros. https://github.com/scala-records/scala-records.
[8]
Martin Odersky. 2015. Add Records To Dotty #964. https://github.com/lampepfl/dotty/issues/964. [Online; accessed 22-May-2017].
[9]
Martin Odersky and Heather Miller. 2017. Scala collection library performance characteristics. https://docs.scala-lang.org/overviews/collections/performance-characteristics.html. [Online; accessed 29-July-2018].
[10]
Atsushi Ohori. 1995. A Polymorphic Record Calculus and Its Compilation. ACM Transactions on Programming Languages and Systems 17, 6 (Nov. 1995), 844-895.
[11]
Bruno C.d.S. Oliveira, Adriaan Moors, and Martin Odersky. 2010. Type Classes As Objects and Implicits. In Proceedings of the ACM International Conference on Object Oriented Programming Systems Languages and Applications (OOPSLA '10). ACM, New York, NY, USA, 341-360.
[12]
David J Pearce and James Noble. 2011. Implementing a language with flow-sensitive and structural typing on the JVM. Electronic Notes in Theoretical Computer Science 279, 1 (2011), 47-59.
[13]
Miles Sabin et al. 2011-2018. Shapeless, Generic programming for Scala. https://github.com/milessabin/shapeless.
[14]
Petr Stefan, Vojtech Horky, Lubomir Bulej, and Petr Tuma. 2017. Unit Testing Performance in Java Projects: Are We There Yet?. In Proceedings of the 8th ACM/SPEC on International Conference on Performance Engineering (ICPE '17). ACM, New York, NY, USA, 401-412.
[15]
Jan Christopher Vogt. 2015. Compossible, Extensible records and type-indexed maps. https://github.com/cvogt/compossible.

Cited By

View all
  • (2020)Automatically Identifying Calling-Prone Higher-Order Functions of Scala Programs to Assist TestersJournal of Computer Science and Technology10.1007/s11390-020-0526-y35:6(1278-1294)Online publication date: 30-Nov-2020
  • (2020)Mining the use of higher-order functions:Empirical Software Engineering10.1007/s10664-020-09842-7Online publication date: 4-Sep-2020
  • (2019)Writing Tests for This Higher-Order Function FirstProceedings of the 11th Asia-Pacific Symposium on Internetware10.1145/3361242.3361256(1-10)Online publication date: 28-Oct-2019

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
Scala 2018: Proceedings of the 9th ACM SIGPLAN International Symposium on Scala
September 2018
82 pages
ISBN:9781450358361
DOI:10.1145/3241653
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

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 17 September 2018

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. Scala
  2. records
  3. structural typing

Qualifiers

  • Research-article

Conference

ICFP '18
Sponsor:

Acceptance Rates

Overall Acceptance Rate 5 of 6 submissions, 83%

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)7
  • Downloads (Last 6 weeks)0
Reflects downloads up to 20 Jan 2025

Other Metrics

Citations

Cited By

View all
  • (2020)Automatically Identifying Calling-Prone Higher-Order Functions of Scala Programs to Assist TestersJournal of Computer Science and Technology10.1007/s11390-020-0526-y35:6(1278-1294)Online publication date: 30-Nov-2020
  • (2020)Mining the use of higher-order functions:Empirical Software Engineering10.1007/s10664-020-09842-7Online publication date: 4-Sep-2020
  • (2019)Writing Tests for This Higher-Order Function FirstProceedings of the 11th Asia-Pacific Symposium on Internetware10.1145/3361242.3361256(1-10)Online publication date: 28-Oct-2019

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media