Reasoning About Polymorphic Behavior
نویسندگان
چکیده
The standard approach to dealing with OO polymorphism is to require subclasses to be behavioral subtypes of the base class. This ensures that reasoning that has been done about any client code that operates on base class objects will continue to be valid if instances of the subclasses are used in place of the base class objects. But often we are interested in stronger properties of the client code, in particular that its behavior will be appropriate to the speciic subclass objects that are used, rather than just generic behavior that ignores the diierences between the diierent subclasses. We present some examples to illustrate the problem, and propose a method of reasoning that allows us to establish stronger properties of the client code on the basis of the richer behavior provided by the appropriate derived classes.
منابع مشابه
Parametricity as Subtyping (preliminary Report)
A polymorphic function is parametric if it has uniform behavior for all type parameters. This property is useful when writing, reasoning about, and compiling functional programs. We show how to syntactically deene and reason about parametricity in a language with intersection types and bounded polymorphism. Within this framework, parametricity is subtyping, and reasoning about para-metricity be...
متن کاملEnriching Subclass Speci cations
The standard approach to reasoning about polymorphic (also called recursive or self) methods is in terms of method reenement. That is, if the correctness of a (polymorphic) method f of class B depends on certain properties of another method g of B, then in any subclass of B in which g is redeened, the designer must make sure that g continues to exhibit these properties. While this allows the de...
متن کاملTemperament and Prosocial Behavior: The Mediating Role of Prosocial Reasoning, Emotion Regulation, and Emotion Lability
Objective: Our study aims to examine the mediating role of prosocial moral reasoning, emotion regulation, and emotion lability in the relation between temperamental characteristics and prosocial behaviour. Methods: In a cross-sectional study, a sample of 202 students were recruited through random multistage sampling method. The participants were interviewed about their prosocial moral reasonin...
متن کاملIncremental Reasoning for Object Oriented Systems
Inheritance and polymorphism are key mechanisms of the object-oriented approach that enable designers to develop systems in an incremental manner. In this paper, we develop techniques for reasoning incrementally about the behavior of such systems. A derived class designer will be able, using the proposed approach, to arrive at the richer behavior that polymorphic methods inherited from the base...
متن کاملA Logic for Parametric Polymorphism with Effects
We present a logic for reasoning about parametric polymorphism in combination with arbitrary computational effects (nondeterminism, exceptions, continuations, side-effects etc.). As examples of reasoning in the logic, we show how to verify correctness of polymorphic type encodings in the presence of effects.
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 1998