{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2026,10,7]],"date-time":"2026-10-07T03:57:53Z","timestamp":1791345473956,"version":"4.3.1"},"reference-count":37,"publisher":"Association for Computing Machinery (ACM)","issue":"OOPSLA","license":[{"start":{"date-parts":[[2020,11,13]],"date-time":"2020-11-13T00:00:00Z","timestamp":1605225600000},"content-version":"vor","delay-in-days":0,"URL":"https:\/\/creativecommons.org\/licenses\/by\/4.0\/"}],"funder":[{"DOI":"10.13039\/100006602","name":"Air Force Research Laboratory","doi-asserted-by":"publisher","award":["A8750-15-C-0010"],"award-info":[{"award-number":["A8750-15-C-0010"]}],"id":[{"id":"10.13039\/100006602","id-type":"DOI","asserted-by":"publisher"}]},{"DOI":"10.13039\/501100000038","name":"Natural Sciences and Engineering Research Council of Canada","doi-asserted-by":"publisher","award":["RGPIN-05799-2014, RGPIN-2020-0550"],"award-info":[{"award-number":["RGPIN-05799-2014, RGPIN-2020-0550"]}],"id":[{"id":"10.13039\/501100000038","id-type":"DOI","asserted-by":"publisher"}]},{"DOI":"10.13039\/100016329","name":"Government of Ontario","doi-asserted-by":"publisher","award":["Early Researcher Award"],"award-info":[{"award-number":["Early Researcher Award"]}],"id":[{"id":"10.13039\/100016329","id-type":"DOI","asserted-by":"publisher"}]}],"content-domain":{"domain":["dl.acm.org"],"crossmark-restriction":true},"short-container-title":["Proc. ACM Program. Lang."],"published-print":{"date-parts":[[2020,11,13]]},"abstract":"<jats:p>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.<\/jats:p>","DOI":"10.1145\/3428210","type":"journal-article","created":{"date-parts":[[2020,11,24]],"date-time":"2020-11-24T23:40:14Z","timestamp":1606261214000},"page":"1-28","update-policy":"https:\/\/doi.org\/10.1145\/crossmark-policy","source":"Crossref","is-referenced-by-count":9,"title":["Precise inference of expressive units of measurement types"],"prefix":"10.1145","volume":"4","author":[{"ORCID":"https:\/\/orcid.org\/0000-0002-0939-3256","authenticated-orcid":false,"given":"Tongtong","family":"Xiang","sequence":"first","affiliation":[{"name":"University of Waterloo, Canada"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"given":"Jeff Y.","family":"Luo","sequence":"additional","affiliation":[{"name":"University of Waterloo, Canada"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"ORCID":"https:\/\/orcid.org\/0000-0002-9316-6952","authenticated-orcid":false,"given":"Werner","family":"Dietl","sequence":"additional","affiliation":[{"name":"University of Waterloo, Canada"}],"role":[{"vocabulary":"crossref","role":"author"}]}],"member":"320","published-online":{"date-parts":[[2020,11,13]]},"reference":[{"key":"e_1_2_2_1_1","first-page":"384","volume-title":"Systems, Languages & Applications (OOPSLA) 39, 10 ( 2004 )","author":"Allen Eric","unstructured":"Eric Allen , David Chase , Victor Luchangco , Jan-Willem Maessen , and Guy L Steele Jr . 2004. Object-oriented units of measurement. Object-Oriented Programming , Systems, Languages & Applications (OOPSLA) 39, 10 ( 2004 ) , 384 - 403 . Eric Allen, David Chase, Victor Luchangco, Jan-Willem Maessen, and Guy L Steele Jr. 2004. Object-oriented units of measurement. Object-Oriented Programming, Systems, Languages & Applications (OOPSLA) 39, 10 ( 2004 ), 384-403."},{"key":"e_1_2_2_2_1","first-page":"121","article-title":"The next 700 unit of measurement checkers","author":"Bennich-Bj\u00f6rkman Oscar","year":"2018","unstructured":"Oscar Bennich-Bj\u00f6rkman and Steve McKeever . 2018 . The next 700 unit of measurement checkers . In Software Language Engineering (SLE). 121 - 132 . Oscar Bennich-Bj\u00f6rkman and Steve McKeever. 2018. The next 700 unit of measurement checkers. In Software Language Engineering (SLE). 121-132.","journal-title":"Software Language Engineering (SLE)."},{"key":"e_1_2_2_3_1","unstructured":"Tom Benson. 2014. Reynolds Number. https:\/\/www.grc.nasa.gov\/WWW\/BGH\/reynolds.html  Tom Benson. 2014. Reynolds Number. https:\/\/www.grc.nasa.gov\/WWW\/BGH\/reynolds.html"},{"key":"e_1_2_2_4_1","unstructured":"Mars Climate Orbiter Mishap Investigation Board. 1999. Mars climate orbiter mishap investigation board: Phase I report. Jet Propulsion Laboratory.  Mars Climate Orbiter Mishap Investigation Board. 1999. Mars climate orbiter mishap investigation board: Phase I report. Jet Propulsion Laboratory."},{"key":"e_1_2_2_5_1","volume-title":"OOPSLA workshop on revival of dynamic languages","volume":"4","author":"Bracha Gilad","year":"2004","unstructured":"Gilad Bracha . 2004 . Pluggable type systems . In OOPSLA workshop on revival of dynamic languages , Vol. 4 . Gilad Bracha. 2004. Pluggable type systems. In OOPSLA workshop on revival of dynamic languages, Vol. 4."},{"key":"e_1_2_2_6_1","first-page":"91","article-title":"Type qualifiers as composable language extensions. In Generative Programming: Concepts & Experiences (GPCE)","author":"Carlson Travis","year":"2017","unstructured":"Travis Carlson and Eric Van Wyk . 2017 . Type qualifiers as composable language extensions. In Generative Programming: Concepts & Experiences (GPCE) . ACM , 91 - 103 . Travis Carlson and Eric Van Wyk. 2017. Type qualifiers as composable language extensions. In Generative Programming: Concepts & Experiences (GPCE). ACM, 91-103.","journal-title":"ACM"},{"key":"e_1_2_2_7_1","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-319-77935-5_6"},{"key":"e_1_2_2_8_1","unstructured":"The Coq Development Team. 2004. The Coq Proof Assistant. https:\/\/coq.inria.fr  The Coq Development Team. 2004. The Coq Proof Assistant. https:\/\/coq.inria.fr"},{"key":"e_1_2_2_9_1","unstructured":"Daikon. 2003. Fix bug that printed milliseconds not seconds. https:\/\/github.com\/codespecs\/daikon\/commit\/ a421b229bbed7da94bd3636c0eb03b716d151d5d  Daikon. 2003. Fix bug that printed milliseconds not seconds. https:\/\/github.com\/codespecs\/daikon\/commit\/ a421b229bbed7da94bd3636c0eb03b716d151d5d"},{"key":"e_1_2_2_10_1","unstructured":"Daikon. 2004. Multiply dkconfig_compile_timeout by 1000 to convert from seconds to milliseconds. https:\/\/github.com\/ codespecs\/daikon\/commit\/1c74cbe4e1fe74d2ef2fc30c577482786d0aca5c  Daikon. 2004. Multiply dkconfig_compile_timeout by 1000 to convert from seconds to milliseconds. https:\/\/github.com\/ codespecs\/daikon\/commit\/1c74cbe4e1fe74d2ef2fc30c577482786d0aca5c"},{"key":"e_1_2_2_11_1","unstructured":"Jean-Marie Dautelle and Werner Keil. 2010. JSR 275: Units Specification API. https:\/\/jcp.org\/en\/jsr\/detail?id= 275  Jean-Marie Dautelle and Werner Keil. 2010. JSR 275: Units Specification API. https:\/\/jcp.org\/en\/jsr\/detail?id= 275"},{"key":"e_1_2_2_12_1","unstructured":"Jean-Marie Dautelle Werner Keil and Leonardo Lima. 2016. JSR 363: Units of Measurement API. https:\/\/jcp.org\/en\/jsr\/ detail?id= 363  Jean-Marie Dautelle Werner Keil and Leonardo Lima. 2016. JSR 363: Units of Measurement API. https:\/\/jcp.org\/en\/jsr\/ detail?id= 363"},{"key":"e_1_2_2_13_1","volume-title":"Tools and Algorithms for the Construction and Analysis of Systems (TACAS)","author":"Moura Leonardo De","unstructured":"Leonardo De Moura and Nikolaj Bj\u00f8rner . 2008. Z3: An eficient SMT solver . In Tools and Algorithms for the Construction and Analysis of Systems (TACAS) . Springer , 337-340. Leonardo De Moura and Nikolaj Bj\u00f8rner. 2008. Z3: An eficient SMT solver. In Tools and Algorithms for the Construction and Analysis of Systems (TACAS). Springer, 337-340."},{"key":"e_1_2_2_14_1","doi-asserted-by":"publisher","DOI":"10.1145\/1985793.1985889"},{"key":"e_1_2_2_15_1","volume-title":"Generic Universe Types. In European Conference on ObjectOriented Programming (ECOOP). Springer, 28-53","author":"Dietl Werner","year":"2007","unstructured":"Werner Dietl , Sophia Drossopoulou , and Peter M\u00fcller . 2007 . Generic Universe Types. In European Conference on ObjectOriented Programming (ECOOP). Springer, 28-53 . Werner Dietl, Sophia Drossopoulou, and Peter M\u00fcller. 2007. Generic Universe Types. In European Conference on ObjectOriented Programming (ECOOP). Springer, 28-53."},{"key":"e_1_2_2_16_1","volume-title":"Tunable Static Inference for Generic Universe Types. In European Conference on Object-Oriented Programming (ECOOP). Springer, 333-357","author":"Dietl Werner","year":"2011","unstructured":"Werner Dietl , Michael D Ernst , and Peter M\u00fcller . 2011 b. Tunable Static Inference for Generic Universe Types. In European Conference on Object-Oriented Programming (ECOOP). Springer, 333-357 . Werner Dietl, Michael D Ernst, and Peter M\u00fcller. 2011b. Tunable Static Inference for Generic Universe Types. In European Conference on Object-Oriented Programming (ECOOP). Springer, 333-357."},{"key":"e_1_2_2_17_1","unstructured":"Michael D Ernst Alex Buckley Werner Dietl Doug Lea Srikanth Sankaran and Oracle. 2012. JSR 308: Annotations on Java Types. https:\/\/jcp.org\/en\/jsr\/detail?id= 308  Michael D Ernst Alex Buckley Werner Dietl Doug Lea Srikanth Sankaran and Oracle. 2012. JSR 308: Annotations on Java Types. https:\/\/jcp.org\/en\/jsr\/detail?id= 308"},{"key":"e_1_2_2_18_1","doi-asserted-by":"crossref","unstructured":"Michael D Ernst Jef H Perkins Philip J Guo Stephen McCamant Carlos Pacheco Matthew S Tschantz and Chen Xiao. 2007. The Daikon system for dynamic detection of likely invariants. Science of computer programming 69 1-3 ( 2007 ) 35-45.  Michael D Ernst Jef H Perkins Philip J Guo Stephen McCamant Carlos Pacheco Matthew S Tschantz and Chen Xiao. 2007. The Daikon system for dynamic detection of likely invariants. Science of computer programming 69 1-3 ( 2007 ) 35-45.","DOI":"10.1016\/j.scico.2007.01.015"},{"key":"e_1_2_2_19_1","doi-asserted-by":"crossref","unstructured":"Narain H. Gehani. 1977. Units of measure as a data attribute. Computer Languages 2 3 ( 1977 ) 93-111.  Narain H. Gehani. 1977. Units of measure as a data attribute. Computer Languages 2 3 ( 1977 ) 93-111.","DOI":"10.1016\/0096-0551(77)90010-8"},{"key":"e_1_2_2_20_1","doi-asserted-by":"crossref","unstructured":"Narain H. Gehani. 1985. Ada's derived types and units of measure. Software: Practice and Experience 15 6 ( 1985 ) 555-569.  Narain H. Gehani. 1985. Ada's derived types and units of measure. Software: Practice and Experience 15 6 ( 1985 ) 555-569.","DOI":"10.1002\/spe.4380150604"},{"key":"e_1_2_2_21_1","doi-asserted-by":"publisher","DOI":"10.1109\/ICSE.2009.5070517"},{"key":"e_1_2_2_22_1","doi-asserted-by":"crossref","unstructured":"Mark Hills Feng Chen and Grigore Ro\u015fu. 2012. A rewriting logic approach to static checking of units of measurement in C. Electronic Notes in Theoretical Computer Science 290 ( 2012 ) 51-67.  Mark Hills Feng Chen and Grigore Ro\u015fu. 2012. A rewriting logic approach to static checking of units of measurement in C. Electronic Notes in Theoretical Computer Science 290 ( 2012 ) 51-67.","DOI":"10.1016\/j.entcs.2012.11.011"},{"key":"e_1_2_2_23_1","doi-asserted-by":"publisher","DOI":"10.1145\/1134285.1134323"},{"key":"e_1_2_2_24_1","unstructured":"Wesley Johnston. 2012. Close by swipe velocity checks are wrong. https:\/\/bugzilla.mozilla.org\/show_bug. cgi?id=765069  Wesley Johnston. 2012. Close by swipe velocity checks are wrong. https:\/\/bugzilla.mozilla.org\/show_bug. cgi?id=765069"},{"key":"e_1_2_2_25_1","doi-asserted-by":"crossref","unstructured":"Nahid Juma Werner Dietl and Mahesh Tripunitara. 2020. A computational complexity analysis of tunable type inference for Generic Universe Types. Theoretical Computer Science 814 ( 2020 ) 189-209.  Nahid Juma Werner Dietl and Mahesh Tripunitara. 2020. A computational complexity analysis of tunable type inference for Generic Universe Types. Theoretical Computer Science 814 ( 2020 ) 189-209.","DOI":"10.1016\/j.tcs.2020.01.035"},{"key":"e_1_2_2_26_1","doi-asserted-by":"publisher","DOI":"10.1145\/3138224"},{"key":"e_1_2_2_27_1","volume-title":"Central European Functional Programming School","author":"Kennedy Andrew","unstructured":"Andrew Kennedy . 2009. Types for units-of-measure: Theory and practice . In Central European Functional Programming School . Springer , 268-305. Andrew Kennedy. 2009. Types for units-of-measure: Theory and practice. In Central European Functional Programming School. Springer, 268-305."},{"key":"e_1_2_2_28_1","first-page":"442","article-title":"Relational parametricity and units of measure. In Principles of Programming Languages (POPL)","author":"Kennedy Andrew J","year":"1997","unstructured":"Andrew J Kennedy . 1997 . Relational parametricity and units of measure. In Principles of Programming Languages (POPL) . ACM , 442 - 455 . Andrew J Kennedy. 1997. Relational parametricity and units of measure. In Principles of Programming Languages (POPL). ACM, 442-455.","journal-title":"ACM"},{"key":"e_1_2_2_29_1","volume-title":"Software Engineering and Formal Methods (SEFM)","author":"Krings Sebastian","unstructured":"Sebastian Krings and Michael Leuschel . 2013. Inferring physical units in B models . In Software Engineering and Formal Methods (SEFM) . Springer , 137-151. Sebastian Krings and Michael Leuschel. 2013. Inferring physical units in B models. In Software Engineering and Formal Methods (SEFM). Springer, 137-151."},{"key":"e_1_2_2_30_1","unstructured":"Andreas Gullberg Larsen. 2018. Units.NET. https:\/\/github.com\/angularsen\/UnitsNet  Andreas Gullberg Larsen. 2018. Units.NET. https:\/\/github.com\/angularsen\/UnitsNet"},{"key":"e_1_2_2_31_1","unstructured":"Jens Melzer. 2015. Autoboxing Performance. https:\/\/efective-java.com\/ 2015 \/01\/autoboxing-performance  Jens Melzer. 2015. Autoboxing Performance. https:\/\/efective-java.com\/ 2015 \/01\/autoboxing-performance"},{"key":"e_1_2_2_32_1","doi-asserted-by":"crossref","unstructured":"Dominic Orchard Andrew Rice and Oleg Oshmyan. 2015. Evolving Fortran types with inferred units-of-measure. Journal of Computational Science 9 ( 2015 ) 156-162.  Dominic Orchard Andrew Rice and Oleg Oshmyan. 2015. Evolving Fortran types with inferred units-of-measure. Journal of Computational Science 9 ( 2015 ) 156-162.","DOI":"10.1016\/j.jocs.2015.04.018"},{"key":"e_1_2_2_33_1","volume-title":"Formal Methods","author":"Owre Sam","unstructured":"Sam Owre , Indranil Saha , and Natarajan Shankar . 2012. Automatic dimensional analysis of cyber-physical systems . In Formal Methods . Springer , 356-371. Sam Owre, Indranil Saha, and Natarajan Shankar. 2012. Automatic dimensional analysis of cyber-physical systems. In Formal Methods. Springer, 356-371."},{"key":"e_1_2_2_34_1","doi-asserted-by":"publisher","DOI":"10.1145\/1390630.1390656"},{"key":"e_1_2_2_35_1","volume-title":"Schabel and Steven Watanabe","author":"Matthias","year":"2010","unstructured":"Matthias C. Schabel and Steven Watanabe . 2010 . Boost .Units. http:\/\/www.boost.org\/doc\/libs\/1_65_1\/doc\/html\/boost_units. html Matthias C. Schabel and Steven Watanabe. 2010. Boost.Units. http:\/\/www.boost.org\/doc\/libs\/1_65_1\/doc\/html\/boost_units. html"},{"key":"e_1_2_2_36_1","unstructured":"Scott Wlaschin. 2012. Units of measure-Type safety for numerics. https:\/\/fsharpforfunandprofit.com\/posts\/units-of-measure  Scott Wlaschin. 2012. Units of measure-Type safety for numerics. https:\/\/fsharpforfunandprofit.com\/posts\/units-of-measure"},{"key":"e_1_2_2_37_1","doi-asserted-by":"crossref","unstructured":"Andrew K Wright and Matthias Felleisen. 1994. A syntactic approach to type soundness. Information and Computation 115 1 ( 1994 ) 38-94.  Andrew K Wright and Matthias Felleisen. 1994. A syntactic approach to type soundness. Information and Computation 115 1 ( 1994 ) 38-94.","DOI":"10.1006\/inco.1994.1093"}],"container-title":["Proceedings of the ACM on Programming Languages"],"original-title":[],"language":"en","link":[{"URL":"https:\/\/dl.acm.org\/doi\/10.1145\/3428210","content-type":"unspecified","content-version":"vor","intended-application":"text-mining"},{"URL":"https:\/\/dl.acm.org\/doi\/pdf\/10.1145\/3428210","content-type":"application\/pdf","content-version":"vor","intended-application":"syndication"},{"URL":"https:\/\/dl.acm.org\/doi\/pdf\/10.1145\/3428210","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2025,6,17]],"date-time":"2025-06-17T22:02:56Z","timestamp":1750197776000},"score":1,"resource":{"primary":{"URL":"https:\/\/dl.acm.org\/doi\/10.1145\/3428210"}},"subtitle":[],"short-title":[],"issued":{"date-parts":[[2020,11,13]]},"references-count":37,"journal-issue":{"issue":"OOPSLA","published-print":{"date-parts":[[2020,11,13]]}},"alternative-id":["10.1145\/3428210"],"URL":"https:\/\/doi.org\/10.1145\/3428210","relation":{},"ISSN":["2475-1421"],"issn-type":[{"value":"2475-1421","type":"electronic"}],"subject":[],"published":{"date-parts":[[2020,11,13]]},"assertion":[{"value":"2020-11-13","order":2,"name":"published","label":"Published","group":{"name":"publication_history","label":"Publication History"}}]}}