Ada中处理运算符重载的一种有效方法

E. Schonberg, Gerald A. Fisher
{"title":"Ada中处理运算符重载的一种有效方法","authors":"E. Schonberg, Gerald A. Fisher","doi":"10.1145/3304133.3304148","DOIUrl":null,"url":null,"abstract":"The coupling of type derivation with operator overloading occupies a substantial portion of the type-checking activities of an Ada compiler. It is thus important to handle overloaded operators as efficiently as possible. Let us recall that the introduction of any type derived from a numeric type, say: type T is range 1 .. 10; (1) creates, at the point of declaration of type T, a new instance of each of the predefined operators that apply to the root type of T, namely INTEGER. In other words, declarations of the form function \"+\"(x, y : T'BASE) return T'BASE; (2) are understood to appear immediately after the declaration (1). (Here T'BASE refers to the anonymous type, derived from integer, of which type T is a subtype). This means that an innocent declaration such as (1) introduces implicitly 16 new operator declarations (10 arithmetic operators and 6 comparison operators). The visibility of operator designators such as \"+\" is described in [RM] in terms of these implicit declarations. In what follows we refer to the operators thus introduced as derived operators, in contrast with user-defined operators, which are introduced by explicit declarations and are given user-defined bodies.","PeriodicalId":304626,"journal":{"name":"Proceedings of the AdaTEC Conference on Ada","volume":"158 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"1982-10-06","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"3","resultStr":"{\"title\":\"An efficient method for handling operator overloading in Ada\",\"authors\":\"E. Schonberg, Gerald A. Fisher\",\"doi\":\"10.1145/3304133.3304148\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"The coupling of type derivation with operator overloading occupies a substantial portion of the type-checking activities of an Ada compiler. It is thus important to handle overloaded operators as efficiently as possible. Let us recall that the introduction of any type derived from a numeric type, say: type T is range 1 .. 10; (1) creates, at the point of declaration of type T, a new instance of each of the predefined operators that apply to the root type of T, namely INTEGER. In other words, declarations of the form function \\\"+\\\"(x, y : T'BASE) return T'BASE; (2) are understood to appear immediately after the declaration (1). (Here T'BASE refers to the anonymous type, derived from integer, of which type T is a subtype). This means that an innocent declaration such as (1) introduces implicitly 16 new operator declarations (10 arithmetic operators and 6 comparison operators). The visibility of operator designators such as \\\"+\\\" is described in [RM] in terms of these implicit declarations. In what follows we refer to the operators thus introduced as derived operators, in contrast with user-defined operators, which are introduced by explicit declarations and are given user-defined bodies.\",\"PeriodicalId\":304626,\"journal\":{\"name\":\"Proceedings of the AdaTEC Conference on Ada\",\"volume\":\"158 1\",\"pages\":\"0\"},\"PeriodicalIF\":0.0000,\"publicationDate\":\"1982-10-06\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"3\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"Proceedings of the AdaTEC Conference on Ada\",\"FirstCategoryId\":\"1085\",\"ListUrlMain\":\"https://doi.org/10.1145/3304133.3304148\",\"RegionNum\":0,\"RegionCategory\":null,\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"\",\"JCRName\":\"\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"Proceedings of the AdaTEC Conference on Ada","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/3304133.3304148","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 3

摘要

类型派生与操作符重载的耦合占据了Ada编译器类型检查活动的很大一部分。因此,尽可能高效地处理重载操作符是非常重要的。让我们回忆一下,从数字类型派生的任何类型的引入,例如:类型T的范围为1 ..10;(1)在声明类型T时,为应用于T的根类型(即INTEGER)的每个预定义操作符创建一个新实例。换句话说,函数"+"(x, y: T'BASE)形式的声明返回T'BASE;(2)被理解为紧跟在声明(1)之后出现(这里T'BASE指的是匿名类型,从整数派生而来,类型T是其子类型)。这意味着(1)这样的简单声明隐式引入了16个新的操作符声明(10个算术操作符和6个比较操作符)。像“+”这样的操作符指示符的可见性在[RM]中根据这些隐式声明进行了描述。在接下来的内容中,我们将这样引入的操作符称为派生操作符,与用户定义操作符形成对比,用户定义操作符由显式声明引入,并给出用户定义的主体。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
查看原文
分享 分享
微信好友 朋友圈 QQ好友 复制链接
本刊更多论文
An efficient method for handling operator overloading in Ada
The coupling of type derivation with operator overloading occupies a substantial portion of the type-checking activities of an Ada compiler. It is thus important to handle overloaded operators as efficiently as possible. Let us recall that the introduction of any type derived from a numeric type, say: type T is range 1 .. 10; (1) creates, at the point of declaration of type T, a new instance of each of the predefined operators that apply to the root type of T, namely INTEGER. In other words, declarations of the form function "+"(x, y : T'BASE) return T'BASE; (2) are understood to appear immediately after the declaration (1). (Here T'BASE refers to the anonymous type, derived from integer, of which type T is a subtype). This means that an innocent declaration such as (1) introduces implicitly 16 new operator declarations (10 arithmetic operators and 6 comparison operators). The visibility of operator designators such as "+" is described in [RM] in terms of these implicit declarations. In what follows we refer to the operators thus introduced as derived operators, in contrast with user-defined operators, which are introduced by explicit declarations and are given user-defined bodies.
求助全文
通过发布文献求助,成功后即可免费获取论文全文。 去求助
来源期刊
自引率
0.00%
发文量
0
期刊最新文献
Design and implementation in Ada of a runtime task supervisor Lolita: a low level intermediate language for Ada Session details: Tools Comparative efficiency of different implementations of the Ada rendezvous Abstract syntax based programming environments
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
现在去查看 取消
×
提示
确定
0
微信
客服QQ
Book学术公众号 扫码关注我们
反馈
×
意见反馈
请填写您的意见或建议
请填写您的手机或邮箱
已复制链接
已复制链接
快去分享给好友吧!
我知道了
×
扫码分享
扫码分享
Book学术官方微信
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术
文献互助 智能选刊 最新文献 互助须知 联系我们:info@booksci.cn
Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。
Copyright © 2023 Book学术 All rights reserved.
ghs 京公网安备 11010802042870号 京ICP备2023020795号-1