{"title":"A Proposal for Making Eiffel Type-Safe","authors":"W. Cook","doi":"10.1093/comjnl/32.4.305","DOIUrl":null,"url":null,"abstract":"Statically type-correct Eiffel programs may produce run-time errors because (1) attributes may be redeclared during inheritance, invalidating assignments in the superclass, (2) a formal method argument type may be restricted in violation of the contravariance of function types, and (3) two applications of a generic class are assumed to conform if the actual arguments conform. The third problem is solved by case analysis on the variance of generic parameters. Declaration by association provides a solution to the first two problems, but it suffers from additional difficulties. Type attributes, or generic parameters with default values, are suggested as a replacement for most cases of declaration by association. The special association type used to express type recursion cannot be explained using type attributes, and it appears to be a truly novel construct for typing object-oriented programs. One consequence of this construct is that Eiffel’s conformance hierarchy is a proper subset of its inheritance hierarchy. To appear in the Proceedings of the European Conference on ObjectOriented Programming, 10-14 July, 1989, and in The Computer Journal, September 1989.","PeriodicalId":80982,"journal":{"name":"Computer/law journal","volume":"27 1","pages":"57-70"},"PeriodicalIF":0.0000,"publicationDate":"1989-07-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"209","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Computer/law journal","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1093/comjnl/32.4.305","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 209
Abstract
Statically type-correct Eiffel programs may produce run-time errors because (1) attributes may be redeclared during inheritance, invalidating assignments in the superclass, (2) a formal method argument type may be restricted in violation of the contravariance of function types, and (3) two applications of a generic class are assumed to conform if the actual arguments conform. The third problem is solved by case analysis on the variance of generic parameters. Declaration by association provides a solution to the first two problems, but it suffers from additional difficulties. Type attributes, or generic parameters with default values, are suggested as a replacement for most cases of declaration by association. The special association type used to express type recursion cannot be explained using type attributes, and it appears to be a truly novel construct for typing object-oriented programs. One consequence of this construct is that Eiffel’s conformance hierarchy is a proper subset of its inheritance hierarchy. To appear in the Proceedings of the European Conference on ObjectOriented Programming, 10-14 July, 1989, and in The Computer Journal, September 1989.