Language constructs inspired by functional programming have made their way into most mainstream programming languages. Many researchers and developers consider that these constructs lead to programs that are more concise, reusable, and easier to understand. However, few studies investigate the implications of using them in mainstream programming languages. This paper quantifies the prevalence of four concepts typically associated with functional programming in JavaScript: recursion, immutability, lazy evaluation, and functions as values. We focus on JavaScript programs due to the availability of some of these concepts in the language since its inception, its inspiration from functional programming languages, and its popularity. We mine 91 GitHub repositories (22+ million LOC) written mostly in JavaScript (over 50% of the code), measuring the usage of these concepts from both static and temporal perspectives. We also measure the likelihood of bug-fixing commits removing uses of these concepts (which would hint at bug-proneness) and their association with the presence of code comments (which would hint at code that is hard to understand). We find that these concepts are in widespread use (1 for every 46.65 LOC, 43.59% of LOC). In addition, the usage of higher-order functions, immutability, and lazy evaluation-related structures has been growing throughout the years for the analyzed projects, while the usage of recursion and callbacks & promises has decreased. We also find statistical evidence that removing these structures, with the exception of the ones associated to immutability, is less common in bug-fixing commits than in other commits. In addition, their presence is not correlated with comment size. Our findings suggest that functional programming concepts are important for developers using a multi-paradigm language, and their usage does not make programs harder to understand.
Labelling Bug-Fixing Commits with Local Open-Weight Language Models
Faculty of Computer Science, University of Vienna(维也纳大学计算机学院);SBA Research gGmbH(SBA研究所);Christian Doppler Laboratory AsTra, University of Vienna(维也纳大学AsTra克里斯蒂安·多普勒实验室)
CIRCLE: Continual Repair across Programming Languages
自动程序修复(APR)的目的是以较少的人工调试工作来修复有缺陷的源代码,它在提高软件可靠性和开发效率方面起着至关重要的作用。最近的APR工作通过应用深度学习(DL),特别是神经机器翻译(NMT)技术取得了显着进展。然而,我们观察到现有的基于DL的APR模型至少有两个严重的缺点:(1)他们大多只能生成一个单一的编程语言的补丁,因此,要修复多种语言,我们必须建立和训练许多修复模型。(2)大多数都是以离线方式开发的。因此,当有新的需求出现时,它们将不起作用。为了解决上述问题,提出了一种基于T5的APR框架,该框架具有跨多种程序设计语言的持续学习能力,即\emph{C} ont \emph{I} nual \emph{R} epair a \emph{C} ross Programming \emph{L} anguag \emph{E} s(\emph{CIRCLE})。具体而言,(1)CIRCLE利用提示功能来缩小自然语言处理(NLP)预训练任务与APR之间的差距。(2)CIRCLE采用基于难度的排练策略,在不访问完整历史数据的情况下实现APR的终身学习。(3)采用弹性正则化方法进一步增强CIRCLE的持续学习能力,防止其发生灾难性遗忘。(4)CIRCLE采用一种简单而有效的重修复方法来修正由于跨多个程序设计语言而产生的错误。我们训练CIRCLE四种语言(即,C、JAVA、JavaSc…