arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1110.4157cs.PL
收藏

并发面向对象程序设计中的通道对象

Channels as Objects in Concurrent Object-Oriented Programming

Joana Campos, Vasco T. Vasconcelos

摘要:

通常每个类都有一种协议,说明何时以及如何调用某些方法。如果这个协议是在类的文档中描述的,当前主流的面向对象语言不能提供对客户端代码遵守所寻求的类行为的验证。我们已经定义了一个基于类的并发面向对象的语言,形式化的使用类型的形式,这样的协议。使用类型被附加到类定义,允许指定(1)可用的方法,(2)客户端必须对方法的结果执行的测试,以及(3)对象状态-线性或共享-所有这些都取决于对象的状态。我们的工作扩展了最近的模块化会话类型的方法,消除通道操作,并定义方法调用作为单一的通信原语在顺序和并发设置。与以前的作品相比,我们定义了一个单一的类别的对象,而不是不同的类别的线性和共享对象,并让线性对象演变成共享的。我们引入了一个标准的同步限定符,以防止在共享对象上的某些操作中出现线程干扰。我们形式化的语言语法,操作语义,和类型系统,强制执行静态类型的方法被称为只有当可用时,并由一个单一的客户端,如果这样指定的使用类型。我们通过一个完整的例子来说明语言。

英文摘要:

There is often a sort of a protocol associated to each class, stating when and how certain methods should be called. Given that this protocol is, if at all, described in the documentation accompanying the class, current mainstream object-oriented languages cannot provide for the verification of client code adherence against the sought class behaviour. We have defined a class-based concurrent object-oriented language that formalises such protocols in the form of usage types. Usage types are attached to class definitions, allowing for the specification of (1) the available methods, (2) the tests clients must perform on the result of methods, and (3) the object status - linear or shared - all of which depend on the object's state. Our work extends the recent approach on modular session types by eliminating channel operations, and defining the method call as the single communication primitive in both sequential and concurrent settings. In contrast to previous works, we define a single category for objects, instead of distinct categories for linear and for shared objects, and let linear objects evolve into shared ones. We introduce a standard sync qualifier to prevent thread interference in certain operations on shared objects. We formalise the language syntax, the operational semantics, and a type system that enforces by static typing that methods are called only when available, and by a single client if so specified in the usage type. We illustrate the language via a complete example.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑