文档下载 文档下载导航
设为首页 | 加入收藏
搜索 请输入内容:  
 导航当前位置: 文档下载 > 所有分类 > Late-bound Pragmatical Class Methods
侵权投诉

Late-bound Pragmatical Class Methods

Binary methods are one of the challenges for designers of object-oriented programming languages. In this paper we discuss binary class methods (class methods that receive parameters of their own class type) as an alternative for typical uses of binary inst

Late-bound Pragmatical Class Methods

AXEL SCHMOLITZKY, MARK EVERED, J. LESLIE KEEDY, GISELA MENGER

Department of Computer Structures

University of Ulm89069 Ulm, Germany

{axel, markev, keedy, gisela}@informatik.uni-ulm.de

are (still) one of the challenges for designers of

Abstract

Binary methods are one of the challenges fordesigners

of

object-oriented

programming

languages. In this paper we discuss binary classmethods (class methods that receive parameters oftheir own class type) as an alternative for typicaluses of binary instances methods and show thatthey are often less troublesome, more symmetricaland more expressive. However, the main drawbackof class methods as they are defined in languageslike C++ and Java is that their static bindingexcludes them from being used in certain code-reuse scenarios that need late-bound self-reference. We propose a small and surprisinglysimple language mechanism to overcome thisdrawback. This mechanism can easily be adoptedby languages that offer statically bound classmethods. We further give the semantics of thisextension as a mapping onto an object modelwithout class methods.

object-oriented programming languages as is welldiscussed in that paper. They can be seen as afocus demonstrating the difficulty of combiningthree partly competing goals of modern object-oriented languages: static type safety encapsulation

flexibility in code reuse

In this paper we discuss binary pragmatical classmethods as an alternative for typical uses ofbinary methods (which will be referred to asbinary instance methods for better distinction).In analogy to the definition of a binary instancemethod we define a binary class method as a classmethod of some class defining type τ that has atleast one parameter of this type τ. As with binaryinstance methods, this definition does not excludefurther parameters, and the typical case of abinary class method is indeed a method with twoparameters of type τ.

We first show that binary pragmatical classmethods are often more appropriate and lesstroublesome than binary instance methods. We

1Introduction

A binary method, as defined in [Bru95], is aninstance method of some object of type τ that hasa parameter of the same type τ. Binary methods

第1页

你可能喜欢

热门文档

相关文档

站点地图 | 文档上传 | 侵权投诉 | 手机版
本站所有资源均来自互联网,本站只负责收集和整理,均不承担任何法律责任,如有侵权等其它行为请联系我们.
文档下载 Copyright 2013 doc.guandang.net All Rights Reserved.  -  email