Layer Activation Mechanism for Asynchronous Executions in JavaScript

Hiroaki Fukuda, Paul Leger, Nicolás Cardozo
{"title":"Layer Activation Mechanism for Asynchronous Executions in JavaScript","authors":"Hiroaki Fukuda, Paul Leger, Nicolás Cardozo","doi":"10.1145/3570353.3570354","DOIUrl":null,"url":null,"abstract":"In modern software development with JavaScript, an asynchronous execution model is often adopted to prevent freezing execution triggered by the blocking operations. JavaScript is now used in various types of applications for the Web, smartphones, and server-side due to its rich ecosystem. In such applications, programmers implement several concerns that should perform different behavior according to the current identified context. Context-Oriented Programming (COP) posits layers as an abstraction to manage such concerns. With COP, programmers can implement context dependent application behavior in a layer, then (de)activate such layers when the context changes, leading to a change in the system behavior. Additionally, COP offers different scoping strategies which define when and how layers should be (de)activated. The dynamic extent of layers is one of such scoping strategies, which encapsulates the duration of a layer within a block, then deactivates the layer when the block execution ends. However, applying an asynchronous execution model breaks the semantics of dynamic extent because the result of an asynchronous execution generally returns when the caller of the asynchronous execution goes through the block. Existing work proposes a variant of the dynamic extent that activates a layer for a block and its logically-connected asynchronous operations by keeping information across them. However, that proposal only supports one of three kinds of asynchronous operations used in JavaScript (MacroTask, EventTask, and MicroTask). This paper extends on the existing work to support a layer activation mechanism with a scoping strategy that fulfills all three kinds of asynchronous operations in JavaScript. We show the benefit of our proposal through the implementation of a real world application for smartphones.","PeriodicalId":340514,"journal":{"name":"Proceedings of the 14th ACM International Workshop on Context-Oriented Programming and Advanced Modularity","volume":"28 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2022-06-07","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"1","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Proceedings of the 14th ACM International Workshop on Context-Oriented Programming and Advanced Modularity","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/3570353.3570354","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 1

Abstract

In modern software development with JavaScript, an asynchronous execution model is often adopted to prevent freezing execution triggered by the blocking operations. JavaScript is now used in various types of applications for the Web, smartphones, and server-side due to its rich ecosystem. In such applications, programmers implement several concerns that should perform different behavior according to the current identified context. Context-Oriented Programming (COP) posits layers as an abstraction to manage such concerns. With COP, programmers can implement context dependent application behavior in a layer, then (de)activate such layers when the context changes, leading to a change in the system behavior. Additionally, COP offers different scoping strategies which define when and how layers should be (de)activated. The dynamic extent of layers is one of such scoping strategies, which encapsulates the duration of a layer within a block, then deactivates the layer when the block execution ends. However, applying an asynchronous execution model breaks the semantics of dynamic extent because the result of an asynchronous execution generally returns when the caller of the asynchronous execution goes through the block. Existing work proposes a variant of the dynamic extent that activates a layer for a block and its logically-connected asynchronous operations by keeping information across them. However, that proposal only supports one of three kinds of asynchronous operations used in JavaScript (MacroTask, EventTask, and MicroTask). This paper extends on the existing work to support a layer activation mechanism with a scoping strategy that fulfills all three kinds of asynchronous operations in JavaScript. We show the benefit of our proposal through the implementation of a real world application for smartphones.
查看原文
分享 分享
微信好友 朋友圈 QQ好友 复制链接
本刊更多论文
JavaScript中异步执行的层激活机制
在现代JavaScript软件开发中,通常采用异步执行模型来防止阻塞操作触发的冻结执行。由于其丰富的生态系统,JavaScript现在被用于各种类型的Web、智能手机和服务器端应用程序。在这样的应用程序中,程序员实现几个关注点,这些关注点应该根据当前确定的上下文执行不同的行为。面向上下文的编程(COP)将层作为管理这些关注点的抽象。使用COP,程序员可以在一个层中实现依赖于上下文的应用程序行为,然后在上下文发生变化时(取消)激活这些层,从而导致系统行为发生变化。此外,COP提供了不同的作用域策略,这些策略定义了何时以及如何激活(取消)层。层的动态范围就是这种作用域策略之一,它将层的持续时间封装在一个块中,然后在块执行结束时停用该层。然而,应用异步执行模型会破坏动态范围的语义,因为异步执行的结果通常在异步执行的调用者通过块时返回。现有的工作提出了一种动态范围的变体,它通过在块及其逻辑连接的异步操作之间保持信息来激活一个层。然而,该提案只支持JavaScript中使用的三种异步操作中的一种(MacroTask、EventTask和MicroTask)。本文在现有工作的基础上进行了扩展,以支持一种层激活机制,该机制的作用域策略可以在JavaScript中实现所有三种异步操作。我们通过智能手机的实际应用程序的实现来展示我们的建议的好处。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 去求助
来源期刊
自引率
0.00%
发文量
0
期刊最新文献
Modeling flexible Monitoring Systems with a Role-Based Control Loop Explicit Tool Support for Implicit Layer Activation A Step toward Programming with Versions in Real-World Functional Languages Layer Activation Mechanism for Asynchronous Executions in JavaScript Guard the Cache: Dispatch Optimization in a Contextual Role-oriented Language
×
引用
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