Lightweight Session Programming in Scala

A. Scalas, N. Yoshida
{"title":"Lightweight Session Programming in Scala","authors":"A. Scalas, N. Yoshida","doi":"10.4230/LIPIcs.ECOOP.2016.21","DOIUrl":null,"url":null,"abstract":"Designing, developing and maintaining concurrent applications is an \nerror-prone and time-consuming task; most difficulties arise because \ncompilers are usually unable to check whether the inputs/outputs \nperformed by a program at runtime will adhere to a given protocol \nspecification. To address this problem, we propose lightweight session programming in Scala: we leverage the native features of the Scala \ntype system and standard library, to introduce (1) a representation of session types as Scala types, and (2) a library, called lchannels, with a convenient API for session-based programming, supporting local and distributed communication. We generalise the idea of Continuation-Passing Style Protocols (CPSPs), studying their formal relationship with session types. We illustrate how session programming can be carried over in Scala: how to formalise a communication protocol, and represent it using Scala classes and lchannels, letting the compiler help spotting protocol violations. We attest the practicality of our approach with a complex use case, and evaluate the performance of lchannels with a series of benchmarks.","PeriodicalId":172012,"journal":{"name":"European Conference on Object-Oriented Programming","volume":"33 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2016-07-17","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"73","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"European Conference on Object-Oriented Programming","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.4230/LIPIcs.ECOOP.2016.21","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 73

Abstract

Designing, developing and maintaining concurrent applications is an error-prone and time-consuming task; most difficulties arise because compilers are usually unable to check whether the inputs/outputs performed by a program at runtime will adhere to a given protocol specification. To address this problem, we propose lightweight session programming in Scala: we leverage the native features of the Scala type system and standard library, to introduce (1) a representation of session types as Scala types, and (2) a library, called lchannels, with a convenient API for session-based programming, supporting local and distributed communication. We generalise the idea of Continuation-Passing Style Protocols (CPSPs), studying their formal relationship with session types. We illustrate how session programming can be carried over in Scala: how to formalise a communication protocol, and represent it using Scala classes and lchannels, letting the compiler help spotting protocol violations. We attest the practicality of our approach with a complex use case, and evaluate the performance of lchannels with a series of benchmarks.
Scala中的轻量级会话编程
设计、开发和维护并发应用程序是一项容易出错且耗时的任务;大多数困难的出现是因为编译器通常无法检查程序在运行时执行的输入/输出是否遵守给定的协议规范。为了解决这个问题,我们在Scala中提出了轻量级会话编程:我们利用Scala类型系统和标准库的本地特性,引入(1)将会话类型表示为Scala类型,以及(2)一个名为lchannels的库,它具有用于基于会话编程的方便API,支持本地和分布式通信。我们推广了延续传递风格协议(cpsp)的思想,研究了它们与会话类型的形式化关系。我们将演示如何在Scala中进行会话编程:如何形式化通信协议,并使用Scala类和通道表示它,让编译器帮助发现协议违规。我们用一个复杂的用例验证了我们方法的实用性,并通过一系列基准测试评估了lchannels的性能。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:604180095
Book学术官方微信