一句话:提出有状态 RPC 演算与位置类型系统,在编程视角支持对称通信、实现采用非对称通信,并统一三种服务器策略。
多级编程语言允许程序员标注代码运行位置,以简化客户端–服务器 Web 应用开发。现有 RPC 演算虽能在程序书写层面提供对称通信,并在 trampolined 风格下以非对称通信实现,但只考虑无状态服务器策略:它把服务器状态编码后传给客户端,因而无法正确处理涉及磁盘或数据库的有状态操作。本文提出有状态 RPC 演算,同时保留程序员视角的对称通信与实现层非对称通信;其核心是新的位置类型系统,为客户端–服务器模型的 RPC 演算理论奠定基础。该理论还能改进无状态策略,构造状态编码演算以消除远程过程调用中的运行时检查,并设计混合策略以兼取两类策略之长。作者声称这是首个在三种策略下同时提供对称通信书写与非对称通信实现的有类型多级演算。
Abstract With multi-tier programming languages, programmers can specify the locations of code to run in order to reduce development efforts for the web-based client–server model where programmers write client and server programs separately and test the multiple programs together. The RPC calculus, one of the foundations of those languages by Cooper and Wadler, has the feature of symmetric communication in programmer’s writing arbitrarily deep nested client–server interactions. The feature of the calculus is fully implemented by asymmetric communication in trampolined style suitable for the client–server model. However, the existing research only considers a stateless server strategy in which all server states are encoded for transmission to the client so that server states do not need to be stored in the server. It cannot always correctly handle all stateful operations involving disks or databases. To resolve this problem, we first propose new stateful calculi that fully support both symmetric communication from the programmer’s viewpoint and asymmetric communication in its implementation using trampolined style. All the existing calculi either provide only the feature of asymmetric communication or propose only symmetric implementation suitable for the peer-to-peer model, rather than the client–server model. Second, the method used to design our stateful server strategy is based on a new locative type system which paves the way for a theory of RPC calculi for the client–server model. Besides proposing the new stateful calculi, this theory can improve the existing stateless server strategy to construct new state-encoding calculi that eliminate runtime checks on remote procedure calls present in the existing strategy, and it enables us to design a new mixed strategy that combines the benefits of both kinds of strategies. As far as we know, there are no typed multi-tier calculi that offer programmers the feature of symmetric communication with the implementation of asymmetric communication under the three strategies together.