首页> 外文OA文献 >Combining the robustness of checked exceptions with the flexibility of unchecked exceptions using anchored exception declarations
【2h】

Combining the robustness of checked exceptions with the flexibility of unchecked exceptions using anchored exception declarations

机译:使用锚定异常声明将检查异常的鲁棒性与非检查异常的灵活性相结合

摘要

Ever since their invention 30 years ago, checked exceptions have been a point of much discussion. On the one hand, they increase the robustness of software by preventing the manifestation of unanticipated checked exceptions at run-time. On the other hand, they decrease the adaptability of software because they must be propagated explicitly, and must often be handled even if they cannot be signalled.We show that the problems with checked exceptions are caused by a lack of expressiveness of the exceptional return type of a method, which currently dictates a copy & paste style. We add the required expressiveness by introducing anchored exception declarations, which allow the exceptional behavior of a method to be declared relative to that of others. We present the formal semantics of anchored exception declarations, along with the necessary rules for ensuring compile-time safety, and give a proof of soundness. We show that anchored exception declarations do not violate the principle of information hiding when used properly, and provide a guideline for when to use them.We have implemented anchored exception declarations in Cappuccino, which is an extension to the ClassicJava programming language.
机译:自30年前发明以来,检查异常一直是很多讨论的重点。一方面,它们通过防止在运行时出现意外的检查异常来提高软件的健壮性。另一方面,它们降低了软件的适应性,因为必须对其进行显式传播,并且即使无法发出信号也必须经常对其进行处理。我们证明,带有检查异常的问题是由异常返回类型的缺乏表达引起的一种方法,目前决定复制和粘贴的样式。我们通过引入锚定异常声明来添加所需的表达,这允许相对于其他方法声明方法的异常行为。我们介绍了锚定异常声明的形式语义,以及确保编译时安全性的必要规则,并给出了可靠的证明。我们展示了锚定异常声明在正确使用时不会违反信息隐藏的原则,并为何时使用它们提供了指导。我们在Cappuccino中实现了锚定异常声明,这是对ClassicJava编程语言的扩展。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号