{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2026,10,2]],"date-time":"2026-10-02T07:49:40Z","timestamp":1790927380224,"version":"4.1.0"},"reference-count":60,"publisher":"Association for Computing Machinery (ACM)","issue":"POPL","license":[{"start":{"date-parts":[[2023,1,9]],"date-time":"2023-01-09T00:00:00Z","timestamp":1673222400000},"content-version":"vor","delay-in-days":0,"URL":"https:\/\/creativecommons.org\/licenses\/by-sa\/4.0\/"}],"funder":[{"name":"Research Grants Council, University Grants Committee, Hong Kong","award":["17209519, 17209520, 17209821"],"award-info":[{"award-number":["17209519, 17209520, 17209821"]}]}],"content-domain":{"domain":["dl.acm.org"],"crossmark-restriction":true},"short-container-title":["Proc. ACM Program. Lang."],"published-print":{"date-parts":[[2023,1,9]]},"abstract":"<jats:p>In programming languages with records, objects, or traits, it is common to have operators that allow dropping, updating or renaming some components. These operators are useful for programmers to explicitly deal with conflicts and override or update some components. While such operators have been studied for record types, little work has been done to generalize and study their theory for other types.<\/jats:p>\n          <jats:p>\n            This paper shows that, given subtyping and disjointness relations, we can specify and derive algorithmic implementations for a general type difference operator that works for other types, including function types, record types and intersection types. When defined in this way, the type difference algebra has many desired properties that are expected from a subtraction operator. Together with a generic\n            <jats:italic>merge<\/jats:italic>\n            operator, using type difference we can generalize many operations on records formalized in the literature. To illustrate the usefulness of type difference we create an intermediate calculus with a rich set of operators on expressions of arbitrary type, and demonstrate applications of these operators in\n            <jats:italic>CP<\/jats:italic>\n            , a prototype language for\n            <jats:italic>Compositional Programming<\/jats:italic>\n            . The semantics of the calculus is given by elaborating into a calculus with\n            <jats:italic>disjoint intersection types<\/jats:italic>\n            and a merge operator. We have implemented type difference and all the operators in the CP language. Moreover, all the calculi and related proofs are mechanically formalized in the Coq theorem prover.\n          <\/jats:p>","DOI":"10.1145\/3571224","type":"journal-article","created":{"date-parts":[[2023,1,11]],"date-time":"2023-01-11T21:58:14Z","timestamp":1673474294000},"page":"893-920","update-policy":"https:\/\/doi.org\/10.1145\/crossmark-policy","source":"Crossref","is-referenced-by-count":7,"title":["Making a Type Difference: Subtraction on Intersection Types as Generalized Record Operations"],"prefix":"10.1145","volume":"7","author":[{"ORCID":"https:\/\/orcid.org\/0000-0002-2548-6866","authenticated-orcid":false,"given":"Han","family":"Xu","sequence":"first","affiliation":[{"name":"Peking University, China"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"ORCID":"https:\/\/orcid.org\/0000-0002-8496-491X","authenticated-orcid":false,"given":"Xuejing","family":"Huang","sequence":"additional","affiliation":[{"name":"University of Hong Kong, China"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"ORCID":"https:\/\/orcid.org\/0000-0002-1846-7210","authenticated-orcid":false,"given":"Bruno C. d. S.","family":"Oliveira","sequence":"additional","affiliation":[{"name":"University of Hong Kong, China"}],"role":[{"vocabulary":"crossref","role":"author"}]}],"member":"320","published-online":{"date-parts":[[2023,1,11]]},"reference":[{"key":"e_1_2_1_1_1","doi-asserted-by":"publisher","DOI":"10.1145\/1391289.1391293"},{"key":"e_1_2_1_2_1","doi-asserted-by":"publisher","DOI":"10.4204\/eptcs.351.1"},{"key":"e_1_2_1_3_1","doi-asserted-by":"publisher","DOI":"10.1145\/937563.937567"},{"key":"e_1_2_1_4_1","doi-asserted-by":"publisher","DOI":"10.1017\/S0960129598002576"},{"key":"e_1_2_1_5_1","doi-asserted-by":"publisher","DOI":"10.1017\/S0956796801004257"},{"key":"e_1_2_1_6_1","doi-asserted-by":"publisher","DOI":"10.1006\/inco.1995.1086"},{"key":"e_1_2_1_7_1","doi-asserted-by":"publisher","DOI":"10.2307\/2273659"},{"key":"e_1_2_1_8_1","doi-asserted-by":"publisher","DOI":"10.1145\/2480359.2429083"},{"key":"e_1_2_1_9_1","doi-asserted-by":"publisher","DOI":"10.4230\/LIPIcs.ECOOP.2018.9"},{"key":"e_1_2_1_10_1","doi-asserted-by":"publisher","DOI":"10.4230\/LIPIcs.ECOOP.2018.22"},{"key":"e_1_2_1_11_1","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-030-17184-1_14"},{"key":"e_1_2_1_12_1","volume-title":"The programming language Jigsaw: mixins, modularity and multiple inheritance","author":"Bracha Gilad","unstructured":"Gilad Bracha . 1992. The programming language Jigsaw: mixins, modularity and multiple inheritance . The University of Utah . Gilad Bracha. 1992. The programming language Jigsaw: mixins, modularity and multiple inheritance. The University of Utah."},{"key":"e_1_2_1_13_1","doi-asserted-by":"publisher","DOI":"10.1145\/97945.97982"},{"key":"e_1_2_1_14_1","doi-asserted-by":"publisher","DOI":"10.1006\/inco.1994.1013"},{"key":"e_1_2_1_15_1","doi-asserted-by":"publisher","DOI":"10.5555\/186677.186701"},{"key":"e_1_2_1_16_1","doi-asserted-by":"publisher","DOI":"10.1145\/6041.6042"},{"key":"e_1_2_1_17_1","volume-title":"Covariance and Controvariance: a fresh look at an old issue (a primer in advanced type systems for learning functional programmers). CoRR, abs\/1809.01427","author":"Castagna Giuseppe","year":"2018","unstructured":"Giuseppe Castagna . 2018. Covariance and Controvariance: a fresh look at an old issue (a primer in advanced type systems for learning functional programmers). CoRR, abs\/1809.01427 ( 2018 ), arXiv:1809.01427. arxiv:1809.01427 Giuseppe Castagna. 2018. Covariance and Controvariance: a fresh look at an old issue (a primer in advanced type systems for learning functional programmers). CoRR, abs\/1809.01427 (2018), arXiv:1809.01427. arxiv:1809.01427"},{"key":"e_1_2_1_18_1","doi-asserted-by":"publisher","DOI":"10.1145\/1069774.1069793"},{"key":"e_1_2_1_19_1","doi-asserted-by":"publisher","DOI":"10.1145\/2676726.2676991"},{"key":"e_1_2_1_20_1","doi-asserted-by":"publisher","DOI":"10.1145\/2535838.2535840"},{"key":"e_1_2_1_21_1","doi-asserted-by":"publisher","DOI":"10.1145\/2951913.2951928"},{"key":"e_1_2_1_22_1","doi-asserted-by":"publisher","DOI":"10.1145\/2034773.2034788"},{"key":"e_1_2_1_23_1","doi-asserted-by":"publisher","DOI":"10.1145\/74878.74922"},{"key":"e_1_2_1_24_1","volume-title":"A new type assignment for \u03bb -terms. Archiv f\u00fcr mathematische Logik und Grundlagenforschung, 19, 1","author":"Coppo Mario","year":"1978","unstructured":"Mario Coppo and Mariangiola Dezani-Ciancaglini . 1978. A new type assignment for \u03bb -terms. Archiv f\u00fcr mathematische Logik und Grundlagenforschung, 19, 1 ( 1978 ), 139\u2013156. Mario Coppo and Mariangiola Dezani-Ciancaglini. 1978. A new type assignment for \u03bb -terms. Archiv f\u00fcr mathematische Logik und Grundlagenforschung, 19, 1 (1978), 139\u2013156."},{"key":"e_1_2_1_25_1","doi-asserted-by":"publisher","DOI":"10.1002\/malq.19810270205"},{"key":"e_1_2_1_26_1","doi-asserted-by":"publisher","DOI":"10.1145\/351240.351259"},{"key":"e_1_2_1_27_1","doi-asserted-by":"publisher","DOI":"10.1145\/232629.232654"},{"key":"e_1_2_1_28_1","doi-asserted-by":"publisher","DOI":"10.1006\/inco.1995.1086"},{"key":"e_1_2_1_29_1","doi-asserted-by":"publisher","DOI":"10.4230\/LIPIcs.ECOOP.2022.18"},{"key":"e_1_2_1_30_1","volume-title":"Electronic proceedings of FOOL.","author":"Fisher Kathleen","year":"2004","unstructured":"Kathleen Fisher and John Reppy . 2004 . A typed calculus of traits . In Electronic proceedings of FOOL. 2004. Kathleen Fisher and John Reppy. 2004. A typed calculus of traits. In Electronic proceedings of FOOL. 2004."},{"key":"e_1_2_1_31_1","doi-asserted-by":"publisher","DOI":"10.1145\/268946.268961"},{"key":"e_1_2_1_32_1","doi-asserted-by":"publisher","DOI":"10.1145\/1391289.1391293"},{"key":"e_1_2_1_33_1","doi-asserted-by":"publisher","DOI":"10.1145\/99583.99603"},{"key":"e_1_2_1_34_1","doi-asserted-by":"publisher","DOI":"10.1145\/99583.99603"},{"key":"e_1_2_1_35_1","doi-asserted-by":"publisher","DOI":"10.1017\/S0956796821000186"},{"key":"e_1_2_1_36_1","volume-title":"Hee Sik Kim, and Eun Hwan Roh","author":"Jun Young Bae","year":"2004","unstructured":"Young Bae Jun , Hee Sik Kim, and Eun Hwan Roh . 2004 . Ideal theory of subtraction algebras. Sci. Math. Jpn. Online e-2004, 397\u2013402. Young Bae Jun, Hee Sik Kim, and Eun Hwan Roh. 2004. Ideal theory of subtraction algebras. Sci. Math. Jpn. Online e-2004, 397\u2013402."},{"key":"e_1_2_1_37_1","volume-title":"European Conference on Object-Oriented Programming. 244\u2013268","author":"Lagorio Giovanni","year":"2009","unstructured":"Giovanni Lagorio , Marco Servetto , and Elena Zucca . 2009 . Featherweight Jigsaw: A minimal core calculus for modular composition of classes . In European Conference on Object-Oriented Programming. 244\u2013268 . Giovanni Lagorio, Marco Servetto, and Elena Zucca. 2009. Featherweight Jigsaw: A minimal core calculus for modular composition of classes. In European Conference on Object-Oriented Programming. 244\u2013268."},{"key":"e_1_2_1_38_1","doi-asserted-by":"publisher","DOI":"10.1093\/logcom\/9.1.105"},{"key":"e_1_2_1_39_1","doi-asserted-by":"publisher","DOI":"10.1145\/3428274"},{"key":"e_1_2_1_40_1","doi-asserted-by":"publisher","DOI":"10.1145\/143165.143200"},{"key":"e_1_2_1_41_1","doi-asserted-by":"publisher","DOI":"10.1145\/218570.218572"},{"key":"e_1_2_1_42_1","doi-asserted-by":"publisher","DOI":"10.1145\/2951913.2951945"},{"key":"e_1_2_1_43_1","doi-asserted-by":"publisher","DOI":"10.1145\/345099.345100"},{"key":"e_1_2_1_44_1","volume-title":"A 3-Part Type Inference Engine","author":"Pottier Fran\u00e7ois","unstructured":"Fran\u00e7ois Pottier . 2000. A 3-Part Type Inference Engine . In Programming Languages and Systems, Gert Smolka (Ed.). Springer Berlin Heidelberg , Berlin, Heidelberg . 320\u2013335. isbn:978-3-540-46425-9 Fran\u00e7ois Pottier. 2000. A 3-Part Type Inference Engine. In Programming Languages and Systems, Gert Smolka (Ed.). Springer Berlin Heidelberg, Berlin, Heidelberg. 320\u2013335. isbn:978-3-540-46425-9"},{"key":"e_1_2_1_45_1","unstructured":"Garrel Pottinger. 1980. A type assignment for the strongly normalizable \u03bb -terms. To HB Curry: essays on combinatory logic lambda calculus and formalism 561\u2013577. \t\t\t\t  Garrel Pottinger. 1980. A type assignment for the strongly normalizable \u03bb -terms. To HB Curry: essays on combinatory logic lambda calculus and formalism 561\u2013577."},{"key":"e_1_2_1_47_1","volume-title":"workshop on Advances in types for computer science at the Newton Institute","author":"R\u00e9my Didier","year":"1995","unstructured":"Didier R\u00e9my . 1995 . A case study of typechecking with constrained types: Typing record concatenation. August , Presented at the workshop on Advances in types for computer science at the Newton Institute , Cambridge, UK. Didier R\u00e9my. 1995. A case study of typechecking with constrained types: Typing record concatenation. August, Presented at the workshop on Advances in types for computer science at the Newton Institute, Cambridge, UK."},{"key":"e_1_2_1_48_1","volume-title":"Preliminary design of the programming language Forsythe","author":"Reynolds John C","unstructured":"John C Reynolds . 1988. Preliminary design of the programming language Forsythe . Carnegie Mellon University . John C Reynolds. 1988. Preliminary design of the programming language Forsythe. Carnegie Mellon University."},{"key":"e_1_2_1_49_1","series-title":"Lecture Notes in Computer Science (LNCS)","volume-title":"The coherence of languages with intersection types","author":"Reynolds John C.","unstructured":"John C. Reynolds . 1991. The coherence of languages with intersection types . In Lecture Notes in Computer Science (LNCS) . Springer Berlin Heidelberg , 675\u2013700. John C. Reynolds. 1991. The coherence of languages with intersection types. In Lecture Notes in Computer Science (LNCS). Springer Berlin Heidelberg, 675\u2013700."},{"key":"e_1_2_1_50_1","doi-asserted-by":"crossref","unstructured":"John C Reynolds. 1997. Design of the programming language Forsythe. In ALGOL-like languages. 173\u2013233. \t\t\t\t  John C Reynolds. 1997. Design of the programming language Forsythe. In ALGOL-like languages. 173\u2013233.","DOI":"10.1007\/978-1-4612-4118-8_9"},{"key":"e_1_2_1_51_1","unstructured":"Scala Community. 2022. Tour of Scala Self-type. https:\/\/docs.scala-lang.org\/tour\/self-types.html \t\t\t\t  Scala Community. 2022. Tour of Scala Self-type. https:\/\/docs.scala-lang.org\/tour\/self-types.html"},{"key":"e_1_2_1_52_1","volume-title":"European Conference on Object-Oriented Programming (ECOOP).","author":"Sch\u00e4rli Nathanael","year":"2003","unstructured":"Nathanael Sch\u00e4rli , St\u00e9phane Ducasse , Oscar Nierstrasz , and Andrew P Black . 2003 . Traits: Composable units of behaviour . In European Conference on Object-Oriented Programming (ECOOP). Nathanael Sch\u00e4rli, St\u00e9phane Ducasse, Oscar Nierstrasz, and Andrew P Black. 2003. Traits: Composable units of behaviour. In European Conference on Object-Oriented Programming (ECOOP)."},{"key":"e_1_2_1_53_1","volume-title":"Difference semigroups. Communications in algebra, 20, 8","author":"Schein Boris M","year":"1992","unstructured":"Boris M Schein . 1992. Difference semigroups. Communications in algebra, 20, 8 ( 1992 ), 2153\u20132169. Boris M Schein. 1992. Difference semigroups. Communications in algebra, 20, 8 (1992), 2153\u20132169."},{"key":"e_1_2_1_54_1","doi-asserted-by":"publisher","DOI":"10.1145\/360204.360230"},{"key":"e_1_2_1_55_1","doi-asserted-by":"publisher","DOI":"10.1016\/j.scico.2020.102470"},{"key":"e_1_2_1_56_1","unstructured":"Philip Wadler. 1998. The expression problem. Java-genericity mailing list. \t\t\t\t  Philip Wadler. 1998. The expression problem. Java-genericity mailing list."},{"key":"e_1_2_1_57_1","doi-asserted-by":"publisher","DOI":"10.1109\/LICS.1989.39162"},{"key":"e_1_2_1_58_1","doi-asserted-by":"publisher","DOI":"10.4230\/LIPIcs.ECOOP.2020.27"},{"key":"e_1_2_1_59_1","doi-asserted-by":"publisher","DOI":"10.5281\/zenodo.7472859"},{"key":"e_1_2_1_60_1","doi-asserted-by":"publisher","DOI":"10.1145\/3460228"},{"key":"e_1_2_1_61_1","volume-title":"Record concatenation with intersection types","author":"Zwanenburg Jan","unstructured":"Jan Zwanenburg . 1995. Record concatenation with intersection types . Eindhoven University of Technology . Jan Zwanenburg. 1995. Record concatenation with intersection types. Eindhoven University of Technology."}],"container-title":["Proceedings of the ACM on Programming Languages"],"original-title":[],"language":"en","link":[{"URL":"https:\/\/dl.acm.org\/doi\/10.1145\/3571224","content-type":"unspecified","content-version":"vor","intended-application":"text-mining"},{"URL":"https:\/\/dl.acm.org\/doi\/pdf\/10.1145\/3571224","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2025,6,17]],"date-time":"2025-06-17T18:08:21Z","timestamp":1750183701000},"score":1,"resource":{"primary":{"URL":"https:\/\/dl.acm.org\/doi\/10.1145\/3571224"}},"subtitle":[],"short-title":[],"issued":{"date-parts":[[2023,1,9]]},"references-count":60,"journal-issue":{"issue":"POPL","published-print":{"date-parts":[[2023,1,9]]}},"alternative-id":["10.1145\/3571224"],"URL":"https:\/\/doi.org\/10.1145\/3571224","relation":{},"ISSN":["2475-1421"],"issn-type":[{"value":"2475-1421","type":"electronic"}],"subject":[],"published":{"date-parts":[[2023,1,9]]},"assertion":[{"value":"2023-01-11","order":2,"name":"published","label":"Published","group":{"name":"publication_history","label":"Publication History"}}]}}