{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2026,10,2]],"date-time":"2026-10-02T08:02:43Z","timestamp":1790928163527,"version":"4.1.0"},"reference-count":43,"publisher":"Association for Computing Machinery (ACM)","issue":"ICFP","license":[{"start":{"date-parts":[[2023,8,30]],"date-time":"2023-08-30T00:00:00Z","timestamp":1693353600000},"content-version":"vor","delay-in-days":0,"URL":"https:\/\/creativecommons.org\/licenses\/by\/4.0\/"}],"funder":[{"DOI":"10.13039\/501100004815","name":"Isaac Newton Trust","doi-asserted-by":"publisher","award":["G101121"],"award-info":[{"award-number":["G101121"]}],"id":[{"id":"10.13039\/501100004815","id-type":"DOI","asserted-by":"publisher"}]},{"name":"EPSRC","award":["EP\/K031724\/2"],"award-info":[{"award-number":["EP\/K031724\/2"]}]},{"DOI":"10.13039\/501100000038","name":"Natural Sciences and Engineering Research Council of Canada","doi-asserted-by":"publisher","award":["RGPIN-2023-04632"],"award-info":[{"award-number":["RGPIN-2023-04632"]}],"id":[{"id":"10.13039\/501100000038","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":[[2023,8,30]]},"abstract":"<jats:p>We introduce MacoCaml, a new design and implementation of compile-time code generation for the OCaml language. MacoCaml features a novel combination of macros with phase separation and quotation-based staging, where macros are considered as compile-time bindings, expression cross evaluation phases using staging annotations, and compile-time evaluation happens inside top-level splices. We provide a theoretical foundation for MacoCaml by formalizing a typed source calculus maco that supports interleaving typing and compile-time code generation, references with explicit compile-time heaps, and modules. We study various crucial properties including soundness and phase distinction. We have implemented MacoCaml in the OCaml compiler, and ported two substantial existing libraries to validate our implementation.<\/jats:p>","DOI":"10.1145\/3607851","type":"journal-article","created":{"date-parts":[[2023,8,31]],"date-time":"2023-08-31T13:40:31Z","timestamp":1693489231000},"page":"604-648","update-policy":"https:\/\/doi.org\/10.1145\/crossmark-policy","source":"Crossref","is-referenced-by-count":16,"title":["MacoCaml: Staging Composable and Compilable Macros"],"prefix":"10.1145","volume":"7","author":[{"ORCID":"https:\/\/orcid.org\/0000-0002-5961-1493","authenticated-orcid":false,"given":"Ningning","family":"Xie","sequence":"first","affiliation":[{"name":"University of Toronto, Canada"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"ORCID":"https:\/\/orcid.org\/0009-0003-7046-3035","authenticated-orcid":false,"given":"Leo","family":"White","sequence":"additional","affiliation":[{"name":"Jane Street, UK"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"ORCID":"https:\/\/orcid.org\/0000-0001-6089-8789","authenticated-orcid":false,"given":"Olivier","family":"Nicole","sequence":"additional","affiliation":[{"name":"Tarides, France"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"ORCID":"https:\/\/orcid.org\/0009-0002-1650-6340","authenticated-orcid":false,"given":"Jeremy","family":"Yallop","sequence":"additional","affiliation":[{"name":"University of Cambridge, UK"}],"role":[{"vocabulary":"crossref","role":"author"}]}],"member":"320","published-online":{"date-parts":[[2023,8,31]]},"reference":[{"key":"e_1_2_1_1_1","unstructured":"David Abrahams and Aleksey Gurtovoy. 2004. C++ template metaprogramming: concepts tools and techniques from Boost and beyond. Pearson Education."},{"key":"e_1_2_1_2_1","doi-asserted-by":"publisher","DOI":"10.1145\/2489837.2489840"},{"key":"e_1_2_1_3_1","doi-asserted-by":"publisher","DOI":"10.1017\/S0956796802004598"},{"key":"e_1_2_1_4_1","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-540-39815-8_4"},{"key":"e_1_2_1_5_1","doi-asserted-by":"publisher","DOI":"10.1007\/11561347_18"},{"key":"e_1_2_1_6_1","doi-asserted-by":"publisher","DOI":"10.1145\/99583.99607"},{"key":"e_1_2_1_7_1","volume-title":"Proceedings of the Eighth Workshop on Scheme and Functional Programming.","author":"Culpepper Ryan","year":"2007","unstructured":"Ryan Culpepper, Sam Tobin-Hochstadt, and Matthew Flatt. 2007. Advanced Macrology and the Implementation of Typed Scheme. In Proceedings of the Eighth Workshop on Scheme and Functional Programming."},{"key":"e_1_2_1_8_1","doi-asserted-by":"publisher","DOI":"10.1109\/LICS.1996.561317"},{"key":"e_1_2_1_9_1","doi-asserted-by":"publisher","DOI":"10.1145\/237721.237788"},{"key":"e_1_2_1_10_1","unstructured":"Daniel de Rauglaudre. 2007. Camlp5 - Reference Manual."},{"key":"e_1_2_1_11_1","volume-title":"Towards a native toplevel for the OCaml language. CoRR, abs\/1110.1029","author":"Fischbach Marcell","year":"2011","unstructured":"Marcell Fischbach and Benedikt Meurer. 2011. Towards a native toplevel for the OCaml language. CoRR, abs\/1110.1029 (2011), arXiv:1110.1029. arxiv:1110.1029"},{"key":"e_1_2_1_12_1","doi-asserted-by":"publisher","DOI":"10.1145\/581478.581486"},{"key":"e_1_2_1_13_1","doi-asserted-by":"publisher","DOI":"10.1145\/2517208.2517211"},{"key":"e_1_2_1_14_1","doi-asserted-by":"publisher","DOI":"10.1017\/S0956796812000093"},{"key":"e_1_2_1_15_1","doi-asserted-by":"publisher","DOI":"10.1145\/507635.507646"},{"key":"e_1_2_1_16_1","doi-asserted-by":"publisher","DOI":"10.1145\/96709.96744"},{"key":"e_1_2_1_17_1","doi-asserted-by":"publisher","DOI":"10.1145\/2847538.2847548"},{"key":"e_1_2_1_18_1","doi-asserted-by":"publisher","DOI":"10.1145\/3498700"},{"key":"e_1_2_1_19_1","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-319-07151-0_6"},{"key":"e_1_2_1_20_1","doi-asserted-by":"publisher","DOI":"10.1145\/3009837"},{"key":"e_1_2_1_21_1","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-319-47958-3_15"},{"key":"e_1_2_1_22_1","doi-asserted-by":"publisher","DOI":"10.1145\/319838.319859"},{"key":"e_1_2_1_23_1","doi-asserted-by":"publisher","DOI":"10.1145\/3547641"},{"key":"e_1_2_1_24_1","doi-asserted-by":"publisher","DOI":"10.1145\/174675.176926"},{"key":"e_1_2_1_25_1","volume-title":"LRT: LexiFi runtime types. https:\/\/github.com\/LexiFi\/lrt Online","year":"2023","unstructured":"Lexifi. 2023. LRT: LexiFi runtime types. https:\/\/github.com\/LexiFi\/lrt Online; accessed March 2023"},{"key":"e_1_2_1_26_1","doi-asserted-by":"publisher","DOI":"10.1145\/73560.73563"},{"key":"e_1_2_1_27_1","doi-asserted-by":"publisher","DOI":"10.1145\/1352582.1352591"},{"key":"e_1_2_1_28_1","doi-asserted-by":"publisher","DOI":"10.1145\/3158101"},{"key":"e_1_2_1_29_1","doi-asserted-by":"publisher","DOI":"10.1145\/1868294.1868314"},{"key":"e_1_2_1_30_1","doi-asserted-by":"publisher","DOI":"10.1145\/3486609.3487209"},{"key":"e_1_2_1_31_1","doi-asserted-by":"publisher","DOI":"10.1145\/3372884.3373160"},{"key":"e_1_2_1_32_1","doi-asserted-by":"publisher","DOI":"10.1145\/581690.581691"},{"key":"e_1_2_1_33_1","doi-asserted-by":"publisher","DOI":"10.1145\/3278122.3278139"},{"key":"e_1_2_1_34_1","doi-asserted-by":"crossref","unstructured":"Walid Taha Zine-El-Abidine Benaissa and Tim Sheard. 1998. Multi-stage programming: Axiomatization and type safety. In International Colloquium on Automata Languages and Programming. 918\u2013929.","DOI":"10.1007\/BFb0055113"},{"key":"e_1_2_1_35_1","volume-title":"OCaml Users and Developers workshop.","author":"Vaugon Beno\u00eet","year":"2013","unstructured":"Beno\u00eet Vaugon. 2013. A new implementation of OCaml formats based on GADTs. OCaml Users and Developers workshop."},{"key":"e_1_2_1_36_1","volume-title":"Re: A regular expression library for OCaml.. https:\/\/github.com\/ocaml\/ocaml-re Online","author":"Vouillon Jerome","year":"2023","unstructured":"Jerome Vouillon. 2023. Re: A regular expression library for OCaml.. https:\/\/github.com\/ocaml\/ocaml-re Online; accessed March 2023"},{"key":"e_1_2_1_37_1","volume-title":"Architecture of Advanced Numerical Analysis Systems: Designing a Scientific Computing System using OCaml","author":"Wang Liang","unstructured":"Liang Wang and Jianxin Zhao. 2022. Architecture of Advanced Numerical Analysis Systems: Designing a Scientific Computing System using OCaml. Apress Berkeley, CA. ISBN 978-1-4842-8852-8"},{"key":"e_1_2_1_38_1","volume-title":"OCaml Users and Developers Workshop.","author":"White Leo","year":"2013","unstructured":"Leo White. 2013. Extension points for OCaml. OCaml Users and Developers Workshop."},{"key":"e_1_2_1_39_1","doi-asserted-by":"publisher","DOI":"10.4204\/EPTCS.198.2"},{"key":"e_1_2_1_40_1","doi-asserted-by":"publisher","DOI":"10.1145\/3498723"},{"key":"e_1_2_1_41_1","doi-asserted-by":"publisher","unstructured":"Ningning Xie Leo White Olivier Nicole and Jeremy Yallop. 2023. MacoCaml: Staging Composable and Compilable Macros (artifact). https:\/\/doi.org\/10.5281\/zenodo.7993994 10.5281\/zenodo.7993994","DOI":"10.5281\/zenodo.7993994"},{"key":"e_1_2_1_42_1","doi-asserted-by":"publisher","DOI":"10.1145\/3110273"},{"key":"e_1_2_1_43_1","doi-asserted-by":"publisher","DOI":"10.1016\/j.scico.2017.04.002"}],"container-title":["Proceedings of the ACM on Programming Languages"],"original-title":[],"language":"en","link":[{"URL":"https:\/\/dl.acm.org\/doi\/10.1145\/3607851","content-type":"unspecified","content-version":"vor","intended-application":"text-mining"},{"URL":"https:\/\/dl.acm.org\/doi\/pdf\/10.1145\/3607851","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2025,6,17]],"date-time":"2025-06-17T12:37:06Z","timestamp":1750163826000},"score":1,"resource":{"primary":{"URL":"https:\/\/dl.acm.org\/doi\/10.1145\/3607851"}},"subtitle":[],"short-title":[],"issued":{"date-parts":[[2023,8,30]]},"references-count":43,"journal-issue":{"issue":"ICFP","published-print":{"date-parts":[[2023,8,30]]}},"alternative-id":["10.1145\/3607851"],"URL":"https:\/\/doi.org\/10.1145\/3607851","relation":{},"ISSN":["2475-1421"],"issn-type":[{"value":"2475-1421","type":"electronic"}],"subject":[],"published":{"date-parts":[[2023,8,30]]},"assertion":[{"value":"2023-08-31","order":2,"name":"published","label":"Published","group":{"name":"publication_history","label":"Publication History"}}]}}