Closure joinpoints: block joinpoints without surprises

E. Bodden
{"title":"Closure joinpoints: block joinpoints without surprises","authors":"E. Bodden","doi":"10.1145/1960275.1960291","DOIUrl":null,"url":null,"abstract":"Block joinpoints allow programmers to explicitly mark regions of base code as \"to be advised\", thus avoiding the need to extract the block into a method just for the sake of creating a joinpoint. Block joinpoints appear simple to define and implement. After all, regular block statements in Java-like languages are constructs well-known to the programmer and have simple control-flow and data-flow semantics.\n Our major insight is, however, that by exposing a block of code as a joinpoint, the code is no longer only called in its declaring static context but also from within aspect code. The block effectively becomes a closure, i.e., an anonymous function that may capture values from the enclosing lexical scope. We discuss research on closures that reveals several important design questions that any semantic definition of closures or block joinpoints must answer. In this paper we show that all existing proposals for block joinpoints answer these questions insufficiently, and hence exhibit a semantics either undefined or likely surprising to Java programmers.\n As a solution, we propose a syntax, semantics, and implementation of Closure Joinpoints, block joinpoints based on closures. As we show, our design decisions yield a semantics that follows the principle of least surprise.","PeriodicalId":353153,"journal":{"name":"Aspect-Oriented Software Development","volume":"46 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2011-03-21","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"32","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Aspect-Oriented Software Development","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/1960275.1960291","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 32

Abstract

Block joinpoints allow programmers to explicitly mark regions of base code as "to be advised", thus avoiding the need to extract the block into a method just for the sake of creating a joinpoint. Block joinpoints appear simple to define and implement. After all, regular block statements in Java-like languages are constructs well-known to the programmer and have simple control-flow and data-flow semantics. Our major insight is, however, that by exposing a block of code as a joinpoint, the code is no longer only called in its declaring static context but also from within aspect code. The block effectively becomes a closure, i.e., an anonymous function that may capture values from the enclosing lexical scope. We discuss research on closures that reveals several important design questions that any semantic definition of closures or block joinpoints must answer. In this paper we show that all existing proposals for block joinpoints answer these questions insufficiently, and hence exhibit a semantics either undefined or likely surprising to Java programmers. As a solution, we propose a syntax, semantics, and implementation of Closure Joinpoints, block joinpoints based on closures. As we show, our design decisions yield a semantics that follows the principle of least surprise.
闭包连接点:没有意外的阻塞连接点
块连接点允许程序员显式地将基本代码的区域标记为“建议”,从而避免了仅仅为了创建连接点而将块提取到方法中的需要。块连接点看起来很容易定义和实现。毕竟,类java语言中的常规块语句是程序员熟悉的结构,具有简单的控制流和数据流语义。然而,我们的主要见解是,通过将代码块作为连接点公开,代码不再仅仅在其声明的静态上下文中调用,而且还可以从方面代码中调用。该块有效地变成了一个闭包,即一个可以从封闭的词法作用域捕获值的匿名函数。我们讨论了关于闭包的研究,这些研究揭示了闭包或块连接点的任何语义定义都必须回答的几个重要设计问题。在本文中,我们表明,所有现有的块连接点建议都不能充分回答这些问题,因此表现出一种语义,要么未定义,要么可能让Java程序员感到惊讶。作为解决方案,我们提出了闭包连接点的语法、语义和实现,即基于闭包的块连接点。正如我们所展示的,我们的设计决策产生遵循最小意外原则的语义。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:604180095
Book学术官方微信