Abstract. We extend the linear π-calculus with composite regular types in such a way that data containing linear values can be shared among several processes, if there is no overlapping access to such values. We describe a type reconstruction algorithm for the extended type system and discuss some practical aspects of its implementation.
IntroductionThe linear π-calculus [15] is a formal model of communicating processes that distinguishes between unlimited and linear channels. Unlimited channels can be used without restrictions, whereas linear channels can be used for one communication only. Despite this seemingly severe restriction, there is evidence that a significant portion of communications in actual systems take place on linear channels [15]. It has also been shown that structured communications can be encoded using linear channels and a continuation-passing style [13,3]. The interest in linear channels has solid motivations: linear channels are efficient to implement, they enable important optimizations [9,8,15], and communications on linear channels enjoy important properties such as interference freedom and partial confluence [18,15]. It follows that understanding whether a channel is used linearly or not has a primary impact in the analysis of systems of communicating processes.Type reconstruction is the problem of inferring the type of entities used in an unannotated (i.e., untyped) program. In the case of the linear π-calculus, the problem translates into understanding whether a channel is linear or unlimited, and determining the type of messages sent over the channel. This problem has been addressed and solved in [10]. This work has been supported by ICT COST Action IC1201 BETTY, MIUR project CINA, Ateneo/CSP project SALT, and the bilateral project RS13MO12 DART. π-calculus extended with pairs, disjoint sums, and possibly infinite types. These features, albeit standard, gain relevance and combine in non-trivial ways with the features of the linear π-calculus. We explain why this is the case in the rest of this section.The term belowmodels a program made of a persistent service (the *-prefixed process waiting for messages on channel succ) that computes the successor of a number and a client (the new-scoped process) that invokes the service and prints the result of the invocation. Each message sent to the service is a pair made of the number x and a continuation channel y on which the service sends the result of the computation back to the client. There are three channels in this program, succ for invoking the service, print for printing numbers, and a private channel a which is used by the client for receiving the result of the invocation. In the linear π-calculus, types keep track of how each occurrence of a channel is being used. For example, the above program is well typed in the environmentwhere the type of print indicates not only the type of messages sent over the channel (int in this case), but also that print is never used for input operations (the 0 annotation) and is used once for one outpu...