Verified Subtyping with Traits and Mixins
نویسنده
چکیده
Traits allow decomposing programs into smaller parts and mixins are a form of composition that resemble multiple inheritance. Unfortunately, in the presence of traits, programming languages like Scala give up on subtyping relation between objects. In this paper, we present a method to check subtyping between objects based on entailment in separation logic. We implement our method as a domain specific language in Scala and apply it on the Scala standard library. We have verified that 67% of mixins used in the Scala standard library do indeed conform to subtyping between the traits that are used to build them.
منابع مشابه
Mixin and Class Subtyping Hierarchies in a Mobile Setting?
In sequential classand mixin-based settings, subtyping is essentially a relation on objects: no subtype relation is defined on classes and mixins, because otherwise there would be conflicts with the inheritance mechanism. Our goals are: (i) to show the usefulness of a subtyping relation extended to classes and mixins in the realm of mobile and distributed processess, where object-oriented code ...
متن کاملSubtyping-inheritance Conflicts: the Mobile
In sequential classand mixin-based settings, subtyping is essentially a relation on objects: no subtype relation is defined on classes and mixins, otherwise there would be conflicts with the inheritance mechanism, creating type un-safety. Nevertheless, a width-depth subtyping relation on class and mixin types is useful in the realm of mobile and distributed processes, where object-oriented code...
متن کاملO'Klaim: A Coordination Language with Mobile Mixins
This paper presents O’Klaim (Object-Oriented Klaim), a linguistic extension of the higher-order calculus for mobile processes Klaim with object-oriented features. Processes interact by an asynchronous communication model: they can distribute and retrieve resources, sometimes structured as incomplete classes, i.e., mixins, to and from distributed tuple spaces. This mechanism is coordinated by pr...
متن کاملA Core Calculus of Classes and Mixins
We develop an imperative calculus that provides a formal model for both single and mixin inheritance. By introducing classes and mixins as the basic object-oriented constructs in a-calculus with records and references, we obtain a system with an intuitive operational semantics. New classes are produced by applying mixins to superclasses. Objects are represented by records and produced by instan...
متن کاملClasses = Traits + States + Glue
We present a simple, component-based model of mixins, called traits , and argue that this simple model sidesteps many of the practical problems with other approaches to mixins and multiple inheritance. With our model, classes are built from a set of traits by specifying glue code that connects them together and accesses the necessary state . We briefly discuss practical experience with an imple...
متن کامل