Pub Date : 2025-09-09DOI: 10.1016/j.scico.2025.103386
Anton Wijs
In 2009, the Simple Language of Communicating Objects (Slco) Domain-Specific Language was designed. Since then, a range of tools have been developed around this language to conduct research on a wide range of topics, all related to the construction of complex, component-based software, with formal verification being applied in every development step. This addresses our vision that formal verification should be seamlessly integrated into Model-Driven Software Engineering, to effectively develop correct software. In this article, we present this range of topics, and draw connections between the various, at first glance disparate, research results. We discuss the current status of the Slco framework, i.e., the language in combination with the tools, related work w.r.t. each of the topics, and plans for future work.
{"title":"An overview of research with Slco on seamless integration of formal verification into model-driven software engineering","authors":"Anton Wijs","doi":"10.1016/j.scico.2025.103386","DOIUrl":"10.1016/j.scico.2025.103386","url":null,"abstract":"<div><div>In 2009, the Simple Language of Communicating Objects (<span>Slco</span>) Domain-Specific Language was designed. Since then, a range of tools have been developed around this language to conduct research on a wide range of topics, all related to the construction of complex, component-based software, with formal verification being applied in every development step. This addresses our vision that formal verification should be seamlessly integrated into Model-Driven Software Engineering, to effectively develop correct software. In this article, we present this range of topics, and draw connections between the various, at first glance disparate, research results. We discuss the current status of the <span>Slco</span> framework, i.e., the language in combination with the tools, related work w.r.t. each of the topics, and plans for future work.</div></div>","PeriodicalId":49561,"journal":{"name":"Science of Computer Programming","volume":"248 ","pages":"Article 103386"},"PeriodicalIF":1.4,"publicationDate":"2025-09-09","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"145048851","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":4,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
Pub Date : 2025-08-31DOI: 10.1016/j.scico.2025.103388
Edson Oliveira Jr (Guest Editors) , Ignacio García Rodríguez de Guzmán (Guest Editors) , Marcela Genero (Guest Editors) , Beatriz Marín (Guest Editors) , Guilherme Travassos (Guest Editors)
{"title":"Preface for “Selected Papers from the 27th Ibero-American Conference on Software Engineering (CIbSE 2024)”","authors":"Edson Oliveira Jr (Guest Editors) , Ignacio García Rodríguez de Guzmán (Guest Editors) , Marcela Genero (Guest Editors) , Beatriz Marín (Guest Editors) , Guilherme Travassos (Guest Editors)","doi":"10.1016/j.scico.2025.103388","DOIUrl":"10.1016/j.scico.2025.103388","url":null,"abstract":"","PeriodicalId":49561,"journal":{"name":"Science of Computer Programming","volume":"248 ","pages":"Article 103388"},"PeriodicalIF":1.4,"publicationDate":"2025-08-31","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"145415842","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":4,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
Pub Date : 2025-08-29DOI: 10.1016/j.scico.2025.103387
Ruibang Liu, Minyu Chen, Ling-I Wu, Jingyu Ke, Guoqiang Li
Automated program verification has always been an important component of building trustworthy software. While the analysis of loops remains a theoretical challenge, the automation of loop invariant analysis has effectively resolved the problem. However, existing invariant generation tools are predominantly effective for programs with purely numerical or purely pointer-based structures. Real-world programs often mix complex data structures and control flows. These structures can include arrays, pointers, and recursive definitions, while control flows may involve multiple nested or concurrent loops. Traditional methods generally only generate invariants for simple numerical programs or specific segments, lacking broad applicability. In order to automatically generate loop invariants for real-world programs, we proposed ACInv, an Automated Complex program loop Invariant generation tool, which combines static analysis with prompting with Large Language Models (LLM) to generate the proper loop invariants. We employ static analysis to systematically decompose the program's data structures and loops. This involves layer-by-layer transmission of structural information about variables, numerical data, and the complete loop structure to the LLM, enabling the generation of corresponding invariants. In comparison to prior work on AutoSpec, we delve deeper into the variable information within each loop. We conducted experiments on ACInv, which showed that ACInv outperformed previous tools on data sets with data structures and maintained similar performance to the state-of-the-art tool AutoSpec on numerical programs without data structures. For the total data set, ACInv can solve 21% more examples than AutoSpec, and can generate reference data structure templates.
{"title":"Enhancing automated loop invariant generation for complex programs with large language models","authors":"Ruibang Liu, Minyu Chen, Ling-I Wu, Jingyu Ke, Guoqiang Li","doi":"10.1016/j.scico.2025.103387","DOIUrl":"10.1016/j.scico.2025.103387","url":null,"abstract":"<div><div>Automated program verification has always been an important component of building trustworthy software. While the analysis of loops remains a theoretical challenge, the automation of loop invariant analysis has effectively resolved the problem. However, existing invariant generation tools are predominantly effective for programs with purely numerical or purely pointer-based structures. Real-world programs often mix complex data structures and control flows. These structures can include arrays, pointers, and recursive definitions, while control flows may involve multiple nested or concurrent loops. Traditional methods generally only generate invariants for simple numerical programs or specific segments, lacking broad applicability. In order to automatically generate loop invariants for real-world programs, we proposed <em>ACInv</em>, an Automated Complex program loop Invariant generation tool, which combines static analysis with prompting with Large Language Models (LLM) to generate the proper loop invariants. We employ static analysis to systematically decompose the program's data structures and loops. This involves layer-by-layer transmission of structural information about variables, numerical data, and the complete loop structure to the LLM, enabling the generation of corresponding invariants. In comparison to prior work on AutoSpec, we delve deeper into the variable information within each loop. We conducted experiments on ACInv, which showed that ACInv outperformed previous tools on data sets with data structures and maintained similar performance to the state-of-the-art tool AutoSpec on numerical programs without data structures. For the total data set, ACInv can solve 21% more examples than AutoSpec, and can generate reference data structure templates.</div></div>","PeriodicalId":49561,"journal":{"name":"Science of Computer Programming","volume":"248 ","pages":"Article 103387"},"PeriodicalIF":1.4,"publicationDate":"2025-08-29","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"144922168","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":4,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
Pub Date : 2025-08-25DOI: 10.1016/j.scico.2025.103384
Paula Herber (Editors of the Special Issue) , Muhammad Osama , Anton Wijs
{"title":"Research software from the integrated Formal Methods (iFM) conference 2023","authors":"Paula Herber (Editors of the Special Issue) , Muhammad Osama , Anton Wijs","doi":"10.1016/j.scico.2025.103384","DOIUrl":"10.1016/j.scico.2025.103384","url":null,"abstract":"","PeriodicalId":49561,"journal":{"name":"Science of Computer Programming","volume":"248 ","pages":"Article 103384"},"PeriodicalIF":1.4,"publicationDate":"2025-08-25","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"145412779","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":4,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
Pub Date : 2025-08-25DOI: 10.1016/j.scico.2025.103385
Cuauhtémoc López-Martín
Software design is a distinctive activity within the software development life cycle (SDLC). It is typically undertaken by an independent, specialized team, whose budget relies on the required person-hours prediction (i.e., effort). An over-prediction could cause project rejection before starting, whereas an under-prediction may result project cancellation before completion. A common practice for predicting the effort percentage by activity involves calculating it from the total SDLC effort. However, the reported design effort using this method varies widely from 0.62% to 50.35%. Another practice involves using prediction models; however, systematic literature reviews published up to 2025 indicate the absence of models specifically applied for software design effort prediction (SDEP) by existing only models addressing the total SDLC effort. Thus, the present study applies two models to SDEP reported as most accurate in the effort prediction field: support vector regression (SVR), and Multi-layer perceptron (MLP) neural network. Their parameters are optimized through genetic algorithms, and their performance is compared to that of a statistical regression model (SRM). All models were trained on seven data sets selected from an international public repository of software projects used in dozens of studies on software effort prediction. Results show that SVR performed statistically better than SRM in five data sets and equally on the remaining two. MLP outperformed SRM on three data sets and equally on the resting four. Consequently, both MLP and SVR can be used to SDEP.
{"title":"Machine learning models for predicting software design effort","authors":"Cuauhtémoc López-Martín","doi":"10.1016/j.scico.2025.103385","DOIUrl":"10.1016/j.scico.2025.103385","url":null,"abstract":"<div><div>Software design is a distinctive activity within the software development life cycle (SDLC). It is typically undertaken by an independent, specialized team, whose budget relies on the required person-hours prediction (i.e., effort). An over-prediction could cause project rejection before starting, whereas an under-prediction may result project cancellation before completion. A common practice for predicting the effort percentage by activity involves calculating it from the total SDLC effort. However, the reported design effort using this method varies widely from 0.62% to 50.35%. Another practice involves using prediction models; however, systematic literature reviews published up to 2025 indicate the absence of models specifically applied for software design effort prediction (SDEP) by existing only models addressing the total SDLC effort. Thus, the present study applies two models to SDEP reported as most accurate in the effort prediction field: support vector regression (SVR), and Multi-layer perceptron (MLP) neural network. Their parameters are optimized through genetic algorithms, and their performance is compared to that of a statistical regression model (SRM). All models were trained on seven data sets selected from an international public repository of software projects used in dozens of studies on software effort prediction. Results show that SVR performed statistically better than SRM in five data sets and equally on the remaining two. MLP outperformed SRM on three data sets and equally on the resting four. Consequently, both MLP and SVR can be used to SDEP.</div></div>","PeriodicalId":49561,"journal":{"name":"Science of Computer Programming","volume":"248 ","pages":"Article 103385"},"PeriodicalIF":1.4,"publicationDate":"2025-08-25","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"144913043","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":4,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
Pub Date : 2025-08-19DOI: 10.1016/j.scico.2025.103383
Maryam Gholami , Jafar Habibi , Maziar Goudarzi
Decision-making in software architecture is complex and requires expertise across domains. A key challenge is balancing software quality attributes. Architectural patterns, as knowledge repositories, offer solutions to recurring design problems. Thus, a structured approach to selecting patterns based on quality requirements is essential.
This paper presents an approach to improve decision-making in selecting architectural patterns concerning software quality attributes. Our method helps architects choose suitable patterns to achieve desired quality outcomes. For new or evolving systems, it recommends patterns aligned with target attributes, while for existing systems, it suggests improvements to enhance architecture.
We use Case-Based Reasoning (CBR) to achieve this goal. Eight architectural patterns were selected as cases, and relevant features were identified using the Repertory Grid Technique (RGT), with feature extraction performed by five experts. By computing similarity between RGT vectors and CBR cases, our method predicts the most appropriate pattern. The proposed approach achieves 83 % accuracy, demonstrating its effectiveness.
{"title":"Enhancing decision-making for software architects: selecting appropriate architectural patterns based on quality attribute requirements","authors":"Maryam Gholami , Jafar Habibi , Maziar Goudarzi","doi":"10.1016/j.scico.2025.103383","DOIUrl":"10.1016/j.scico.2025.103383","url":null,"abstract":"<div><div>Decision-making in software architecture is complex and requires expertise across domains. A key challenge is balancing software quality attributes. Architectural patterns, as knowledge repositories, offer solutions to recurring design problems. Thus, a structured approach to selecting patterns based on quality requirements is essential.</div><div>This paper presents an approach to improve decision-making in selecting architectural patterns concerning software quality attributes. Our method helps architects choose suitable patterns to achieve desired quality outcomes. For new or evolving systems, it recommends patterns aligned with target attributes, while for existing systems, it suggests improvements to enhance architecture.</div><div>We use Case-Based Reasoning (CBR) to achieve this goal. Eight architectural patterns were selected as cases, and relevant features were identified using the Repertory Grid Technique (RGT), with feature extraction performed by five experts. By computing similarity between RGT vectors and CBR cases, our method predicts the most appropriate pattern. The proposed approach achieves 83 % accuracy, demonstrating its effectiveness.</div></div>","PeriodicalId":49561,"journal":{"name":"Science of Computer Programming","volume":"248 ","pages":"Article 103383"},"PeriodicalIF":1.4,"publicationDate":"2025-08-19","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"144895138","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":4,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
Pub Date : 2025-08-13DOI: 10.1016/j.scico.2025.103380
Matteo Cimini, Joan Montas
Language verification is an important aspect in the cycle of programming language development, especially when such endeavor establishes properties of programming languages with mathematical proofs. Prior work proposed , which is a domain-specific language for expressing language-parameterized proofs, that is, proofs that apply to classes of languages rather than a single language. Such work developed the language-parameterized proofs of type soundness (excluding the substitution lemmas) for a certain class of functional languages. In this paper, we extend that work to include subtyping. We have added new operations to for expressing the proofs that are related to subtyping more naturally. We provide a semantics of our new system based on a compilation into proofs of the Abella proof assistant. Next, we develop language-parameterized proofs of type soundness (excluding the substitution lemmas) for the class of functional languages mentioned above, and of the equivalence between algorithmic and declarative subtyping. Our extended generates Abella proofs that machine-check the type soundness of a nontrivial class of functional languages with declarative and algorithmic subtyping, when just a few simple lemmas are admitted.
{"title":"Type soundness of functional languages with subtyping in Lang-n-Prove","authors":"Matteo Cimini, Joan Montas","doi":"10.1016/j.scico.2025.103380","DOIUrl":"10.1016/j.scico.2025.103380","url":null,"abstract":"<div><div>Language verification is an important aspect in the cycle of programming language development, especially when such endeavor establishes properties of programming languages with mathematical proofs. Prior work proposed <figure><img></figure>, which is a domain-specific language for expressing language-parameterized proofs, that is, proofs that apply to classes of languages rather than a single language. Such work developed the language-parameterized proofs of type soundness (excluding the substitution lemmas) for a certain class of functional languages. In this paper, we extend that work to include subtyping. We have added new operations to <figure><img></figure> for expressing the proofs that are related to subtyping more naturally. We provide a semantics of our new system based on a compilation into proofs of the Abella proof assistant. Next, we develop language-parameterized proofs of type soundness (excluding the substitution lemmas) for the class of functional languages mentioned above, and of the equivalence between algorithmic and declarative subtyping. Our extended <figure><img></figure> generates Abella proofs that machine-check the type soundness of a nontrivial class of functional languages with declarative and algorithmic subtyping, when just a few simple lemmas are admitted.</div></div>","PeriodicalId":49561,"journal":{"name":"Science of Computer Programming","volume":"248 ","pages":"Article 103380"},"PeriodicalIF":1.4,"publicationDate":"2025-08-13","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"144867123","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":4,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
Pub Date : 2025-08-13DOI: 10.1016/j.scico.2025.103381
Yongchang Ding , Wei Han , Zhiqiang Li , Haowen Chen , Linjun Chen , Rong Peng , Xiao-Yuan Jing
In the field of software engineering, defect prediction has always been a popular research direction. Currently, the research on traditional software defect prediction mainly focuses on metric features, which are derived from various descriptive rules. Many researchers have proposed a large number of defect prediction models based on these metric features and various framework models. However, the problem of data scarcity has severely hindered the development of the field. Therefore, this work proposes a new method, namely the Metric Attention Module (MAM), which excavates the correlations within the metric data features, between features, within modules, and between modules. By learning new data representations, MAM guides the model's learning process and ultimately improves the model's performance without changing the network framework structure. Additionally, the method is interpretable.
In this work, experiments were conducted in various task environments and on different datasets, all resulting in varying degrees of improvement. In the context of within-project defect prediction (WPDP), experiments with the MAM data model showed an average improvement of 14.7% in Accuracy, 15.9% in F1 score, 23.7% in AUC, and 65.1% in MCC. In cross-project defect prediction (CPDP), under more complex task environments, the model demonstrated excellent performance across multiple standard datasets. Compared to the baseline models and training results, the F1, Accuracy, and MCC scores improved by approximately 40%, 20%, and 50%, respectively.
{"title":"Metric information mining with metric attention to boost software defect prediction performance","authors":"Yongchang Ding , Wei Han , Zhiqiang Li , Haowen Chen , Linjun Chen , Rong Peng , Xiao-Yuan Jing","doi":"10.1016/j.scico.2025.103381","DOIUrl":"10.1016/j.scico.2025.103381","url":null,"abstract":"<div><div>In the field of software engineering, defect prediction has always been a popular research direction. Currently, the research on traditional software defect prediction mainly focuses on metric features, which are derived from various descriptive rules. Many researchers have proposed a large number of defect prediction models based on these metric features and various framework models. However, the problem of data scarcity has severely hindered the development of the field. Therefore, this work proposes a new method, namely the Metric Attention Module (MAM), which excavates the correlations within the metric data features, between features, within modules, and between modules. By learning new data representations, MAM guides the model's learning process and ultimately improves the model's performance without changing the network framework structure. Additionally, the method is interpretable.</div><div>In this work, experiments were conducted in various task environments and on different datasets, all resulting in varying degrees of improvement. In the context of within-project defect prediction (WPDP), experiments with the MAM data model showed an average improvement of 14.7% in Accuracy, 15.9% in F1 score, 23.7% in AUC, and 65.1% in MCC. In cross-project defect prediction (CPDP), under more complex task environments, the model demonstrated excellent performance across multiple standard datasets. Compared to the baseline models and training results, the F1, Accuracy, and MCC scores improved by approximately 40%, 20%, and 50%, respectively.</div></div>","PeriodicalId":49561,"journal":{"name":"Science of Computer Programming","volume":"248 ","pages":"Article 103381"},"PeriodicalIF":1.4,"publicationDate":"2025-08-13","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"144861269","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":4,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
This paper presents enhanced schedulability analysis techniques for Adaptive Mixed-Criticality systems with Weakly-Hard constraints (AMC-WH), where the low-criticality (LO) task jobs can continue to execute when the system switches to high-criticality (HI) mode. Prior AMC-WH studies typically adopt the skip-over model, in which up to s out of m consecutive LO task deadlines may be missed without violating system constraints. These approaches evaluate the Worst-Case Response Times (WCRT) of LO tasks under a fixed job execution pattern. In contrast, this work introduces a novel schedulability analysis framework based on the more general -firm model, where each LO task must meet at least m out of any k consecutive deadlines. This extension allows for more flexible and configurable execution patterns for LO tasks after a mode transition, improving the adaptability of the system to varying operational conditions. Additionally, we propose an exact schedulability test for AMC-WH based on Response Time Analysis (RTA), which incorporates the -firm model to precisely analyze schedulability by dynamically managing LO task execution patterns post-mode switch. Comprehensive experimental evaluations confirm the effectiveness and practicality of the proposed tests. In particular, our approach achieves an 18% improvement in schedulability compared to the AMC-WH skip-over baseline, while also optimizing resource utilization. By leveraging the flexibility of the -firm model, our method supports a wide range of real-time applications with diverse tolerance levels for deadline misses, offering enhanced adaptability in LO task execution strategies.
{"title":"Exact and sufficient schedulability tests for adaptive weakly-hard real-time mixed-criticality systems","authors":"Hossein Rabbiun , Mahmoud Shirazi , Jamal Mohammadi","doi":"10.1016/j.scico.2025.103382","DOIUrl":"10.1016/j.scico.2025.103382","url":null,"abstract":"<div><div>This paper presents enhanced schedulability analysis techniques for Adaptive Mixed-Criticality systems with Weakly-Hard constraints (AMC-WH), where the low-criticality (LO) task jobs can continue to execute when the system switches to high-criticality (HI) mode. Prior AMC-WH studies typically adopt the skip-over model, in which up to <em>s</em> out of <em>m</em> consecutive LO task deadlines may be missed without violating system constraints. These approaches evaluate the Worst-Case Response Times (WCRT) of LO tasks under a fixed job execution pattern. In contrast, this work introduces a novel schedulability analysis framework based on the more general <span><math><mo>(</mo><mi>m</mi><mo>,</mo><mi>k</mi><mo>)</mo></math></span>-firm model, where each LO task must meet at least <em>m</em> out of any <em>k</em> consecutive deadlines. This extension allows for more flexible and configurable execution patterns for LO tasks after a mode transition, improving the adaptability of the system to varying operational conditions. Additionally, we propose an exact schedulability test for AMC-WH based on Response Time Analysis (RTA), which incorporates the <span><math><mo>(</mo><mi>m</mi><mo>,</mo><mi>k</mi><mo>)</mo></math></span>-firm model to precisely analyze schedulability by dynamically managing LO task execution patterns post-mode switch. Comprehensive experimental evaluations confirm the effectiveness and practicality of the proposed tests. In particular, our approach achieves an 18% improvement in schedulability compared to the AMC-WH skip-over baseline, while also optimizing resource utilization. By leveraging the flexibility of the <span><math><mo>(</mo><mi>m</mi><mo>,</mo><mi>k</mi><mo>)</mo></math></span>-firm model, our method supports a wide range of real-time applications with diverse tolerance levels for deadline misses, offering enhanced adaptability in LO task execution strategies.</div></div>","PeriodicalId":49561,"journal":{"name":"Science of Computer Programming","volume":"248 ","pages":"Article 103382"},"PeriodicalIF":1.4,"publicationDate":"2025-08-11","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"144830040","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":4,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
Pub Date : 2025-08-11DOI: 10.1016/j.scico.2025.103379
Takashi Suwa , Atsushi Igarashi
We propose MetaFM, a novel ML-style module system that enables users to decompose multi-stage programs (i.e., programs written in a typed multi-stage programming language) into loosely coupled components in a manner natural with respect to type abstraction. The distinctive aspect of MetaFM is that it allows values at different stages to be bound in a single structure (i.e., ). This feature is crucial, for example, for defining a function and a macro that use one abstract type in common without revealing the implementation detail of that type. MetaFM also accommodates staging with full-fledged module-related features such as functors, higher-kinded types, and the with type-construct. We give two separate formalizations of MetaFM's semantics by employing the technique of elaborations, i.e., type-directed translations to target languages. Specifically, we first define F-ing Modules-based semantics as a set of elaboration rules that convert MetaFM programs into System F, a multi-stage extension of System Fω, and prove that the elaboration preserves typing. The existential quantification offered by System F demonstrates that a type abstraction mechanism is properly formalized in our language. Then, because our F-ing Modules-based semantics of staging has some issues as to the evaluation order, we give another elaboration by utilizing a method called static interpretation, which flattens nested structures into arrays of bindings and inlines functor applications through type-checking. While our F-ing Modules-based semantics cannot be naturally extended with effectful computations, the static interpretation-based one can easily accommodate effectful features such as mutable references, though this is achieved with the limitation that functors must be first-order for the moment. As a sideline, we develop a technique that simplifies the correctness proof of the static interpretation for first-order functors. Additionally, our language supports cross-stage persistence (CSP), a feature for code reuse spanning more than one stage, without breaking type safety. We also implemented a module system for a language of real-world use based on the latter semantics to demonstrate the utility of our formalization.
{"title":"An ML-style module system for cross-stage type abstraction in multi-stage programming","authors":"Takashi Suwa , Atsushi Igarashi","doi":"10.1016/j.scico.2025.103379","DOIUrl":"10.1016/j.scico.2025.103379","url":null,"abstract":"<div><div>We propose <em>MetaFM</em>, a novel ML-style module system that enables users to decompose <em>multi-stage programs</em> (i.e., programs written in a typed <em>multi-stage programming</em> language) into loosely coupled components in a manner natural with respect to type abstraction. The distinctive aspect of MetaFM is that it allows values at different stages to be bound in a single structure (i.e., <span><math><mrow><mi>struct</mi></mrow><mspace></mspace><mo>⋯</mo><mspace></mspace><mrow><mi>end</mi></mrow></math></span>). This feature is crucial, for example, for defining a function and a macro that use one abstract type in common without revealing the implementation detail of that type. MetaFM also accommodates staging with full-fledged module-related features such as <em>functors</em>, <em>higher-kinded types</em>, and the <strong>with type</strong><em>-construct</em>. We give two separate formalizations of MetaFM's semantics by employing the technique of <em>elaborations</em>, i.e., type-directed translations to target languages. Specifically, we first define <em>F-ing Modules</em>-based semantics as a set of elaboration rules that convert MetaFM programs into <em>System F</em><span><math><msup><mrow><mi>ω</mi></mrow><mrow><mo>〈</mo><mo>〉</mo></mrow></msup></math></span>, a multi-stage extension of System F<em>ω</em>, and prove that the elaboration preserves typing. The existential quantification offered by System F<span><math><msup><mrow><mi>ω</mi></mrow><mrow><mo>〈</mo><mo>〉</mo></mrow></msup></math></span> demonstrates that a type abstraction mechanism is properly formalized in our language. Then, because our F-ing Modules-based semantics of staging has some issues as to the evaluation order, we give another elaboration by utilizing a method called <em>static interpretation</em>, which flattens nested structures into arrays of bindings and inlines functor applications through type-checking. While our F-ing Modules-based semantics cannot be naturally extended with effectful computations, the static interpretation-based one can easily accommodate effectful features such as mutable references, though this is achieved with the limitation that functors must be first-order for the moment. As a sideline, we develop a technique that simplifies the correctness proof of the static interpretation for first-order functors. Additionally, our language supports <em>cross-stage persistence</em> (<em>CSP</em>), a feature for code reuse spanning more than one stage, without breaking type safety. We also implemented a module system for a language of real-world use based on the latter semantics to demonstrate the utility of our formalization.</div></div>","PeriodicalId":49561,"journal":{"name":"Science of Computer Programming","volume":"248 ","pages":"Article 103379"},"PeriodicalIF":1.4,"publicationDate":"2025-08-11","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"144830041","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":4,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}