Flexible Method Combination based on Mixin Subtyping

نویسندگان

  • Tetsuo Kamina
  • Tetsuo Tamai
چکیده

A mixin is a reusable module that provides uniform extensions and modifications to classes. It is an abstract subclass that is composable with a variety of superclasses. In mixin-based composition, however, the problem of accidental overriding arises. A method declared in a mixin may accidentally override its superclass’s method. To tackle this problem, we propose a selective method combination that selects where the method invocation starts, and where method body execution jumps in the case of super invocation, by using the static type information of the receiver. We use the flexible mixin-based subtyping rules that allow subtype relations to be not restricted to the immediate inheritance relations; therefore, flexible control of method combination is achieved. To describe precisely how selective method combination works, we formalize this mechanism over McJava, an extension of Java with mixin-types. We also implement this mechanism by source code translation to Java thus making it runnable on a standard Java virtual machine.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Safe and Flexible Objects with Subtyping

We design a calculus where objects are created by instantiating classes, as well as mixins. Mixin-instantiated objects are “incomplete objects”, that can be completed in an object-based fashion. The combination of class-based features with object-based ones offers some flexible programming solutions. The fact that all objects are created from fully-typed constructs is a guarantee of controlled ...

متن کامل

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...

متن کامل

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 ...

متن کامل

A Core Calculus for Mixin-Types

The programming construct mixin was invented to implement modules that provide the mechanism of abstracting uniform extensions and modifications to superclasses. One approach to implement a mixin is to parameterize a superclass of a generic class using a type parameter; however, this approach lacks the ability to declare a mixin that is also used as a type. In this paper, we propose a programmi...

متن کامل

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 sp...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:
  • Journal of Object Technology

دوره 4  شماره 

صفحات  -

تاریخ انتشار 2005