Precise inference of expressive units of measurement types
Tongtong Xiang, Jeff Y. Luo, Werner Dietl
摘要
Ensuring computations are unit-wise consistent is an important task in software development. Numeric computations are usually performed with primitive types instead of abstract data types, which results in very weak static guarantees about correct usage and conversion of units. This paper presents PUnits, a pluggable type system for expressive units of measurement types and a precise, whole-program inference approach for these types. PUnits can be used in three modes: (1) modularly check the correctness of a program, (2) ensure a possible unit typing exists, and (3) annotate a program with units. Annotation mode allows human inspection and is essential since having a valid typing does not guarantee that the inferred specification expresses design intent. PUnits is the first units type system with this capability. Compared to prior work, PUnits strikes a novel balance between expressiveness, inference complexity, and annotation effort. We implement PUnits for Java and evaluate it by specifying the correct usage of frequently used JDK methods. We analyze 234k lines of code from eight open-source scientific computing projects with PUnits. We compare PUnits against an encapsulation-based units API (the javax.measure package) and discovered unit errors that the API failed to find. PUnits infers 90 scientific units for five of the projects and generates well-specified applications. The experiments show that PUnits is an effective, sound, and scalable alternative to using encapsulation-based units APIs, enabling Java developers to reap the performance benefits of using primitive types instead of abstract data types for unit-wise consistent scientific computations.
问问这篇 Paper
问问你的智能体。
Lune 读过与它相关的顶会 Paper,每个回答都会注明依据哪几篇。
引用它的顶会 Paper3
- Scalability and precision by combining expressive type systems and deductive verificationFlorian Lanzinger, Alexander Weigl, Mattias Ulbrich, Werner DietlOOPSLA 2021 · 被引用 6 次
- Practical Inference of Nullability TypesNima Karimipour, Justin Pham, Lazaro Clapp, Manu SridharanFSE 2023 · 被引用 6 次
- Pluggable Type Inference for FreeMartin Kellogg, Daniel Daskiewicz, Loi Ngo Duc Nguyen, Muyeed Ahmed 等ASE 2023 · 被引用 4 次
相关 Paper
- Understanding and Detecting Annotation-Induced Faults of Static AnalyzersHuaien Zhang, Yu Pei, Shuyun Liang, Shin Hwei TanFSE 2024 · 被引用 4 次
- Usability-Oriented Design of Liquid Types for JavaCatarina Gamboa, Paulo Canelas, Christopher Steven Timperley, Alcides FonsecaICSE 2023 · 被引用 9 次
- SA4U: Practical Static Analysis for Unit Type Error DetectionMax Taylor, Johnathon Aurand, Feng Qin, Xiaorui Wang 等ASE 2022 · 被引用 5 次
- MixedSAND: Semantic Annotation of Mixed-unit Numeric DataAmir Behrad Khorram Nazari, Davood Rafiei, Mario A. NascimentoWWW 2025 · 被引用 1 次
- Flexible Type-Based Resource Estimation in Quantum Circuit Description LanguagesAndrea Colledan, Ugo Dal LagoPOPL 2025 · 被引用 3 次
