Abstract

Multitier programming languages reduce the complexity of developing distributed systems by developing the distributed system in a single coherent code base. The compiler or the runtime separate the code for the components of the distributed system, enabling abstraction over low level implementation details such as data representation, serialization and network protocols. Our ScalaLoci language allows developers to declare the different components and their architectural relation at the type level, allowing static reasoning about about distribution and remote communication and guaranteeing static type safety across components. The compiler splits the multitier program into the component-specific code and automatically generates the communication boilerplate. Communication between components can be modeled by declaratively specifying data flows between components using reactive programming. In this paper, we report on the implementation of our design and our experience with embedding our language features into Scala as a host language. We show how a combination of Scala's advanced type level programming and its macro system can be used to enrich the language with new abstractions. We comment on the challenges we encountered and the solutions we developed for our current implementation and outline suggestions for an improved macro system to support the such use cases of embedding of domain-specific abstractions.

Highlights

  • IntroductionDeveloping distributed systems adds significant complexity over programming local applications

  • We report on the ScalaLoci implementation and on our experience with embedding ScalaLoci’s language features into Scala as a host language

  • We show how the ScalaLoci design is embedded into Scala and how ScalaLoci’s domain-specific abstractions are translated into plain Scala with a combination of type level and macro programming

Read more

Summary

Introduction

Developing distributed systems adds significant complexity over programming local applications. Widely used languages provide poor abstractions for distribution, either (i) making distribution completely transparent (e.g., distributed shared memory [38]), (ii) providing a high-level programming model only for a specific domain, such as big data or streaming systems [16, 62, 10] or (iii) being general purpose but providing only low-level communication primitives, such as message passing in the actor model [1]. We provide insights into our approach of embedding ScalaLoci abstractions as a domain-specific language into Scala and describe our experiences with using Scala’s type level programming features and Scala’s macro system to perform extensive AST transformations. We show how the ScalaLoci design is embedded into Scala and how ScalaLoci’s domain-specific abstractions are translated into plain Scala with a combination of type level and macro programming. We present the design of our network communication runtime which hides the implementation details of different underlying network protocols and the semantics of accessing values of different types.

Design Approach of ScalaLoci
Design Requirements
ScalaLoci in Nuce
Overview of the ScalaLoci Architecture
Cross-Platform Compilation
Type Level Encoding
Lexical Context
Distributed Architecture
Lessons Learned
Macro Expansion
Macros Architecture
Code Splitting Process
Macro Expansion for Remote Access
Peer Contexts
Interaction with the Type System
Runtime
Communicators
Serializers
Transmitters
Related Work
Conclusion
Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call