TY - GEN
T1 - Type Tailoring
AU - Wiersdorf, Ashton
AU - Chang, Stephen
AU - Felleisen, Matthias
AU - Greenman, Ben
N1 - Publisher Copyright:
© Ashton Wiersdorf, Stephen Chang, Matthias Felleisen, and Ben Greenman;
PY - 2024/9
Y1 - 2024/9
N2 - Type systems evolve too slowly to keep up with the quick evolution of libraries – especially libraries that introduce abstractions. Type tailoring offers a lightweight solution by equipping the core language with an API for modifying the elaboration of surface code into the internal language of the typechecker. Through user-programmable elaboration, tailoring rules appear to improve the precision and expressiveness of the underlying type system. Furthermore, type tailoring cooperates with the host type system by expanding to code that the host then typechecks. In the context of a hygienic metaprogramming system, tailoring rules can even harmoniously compose with one another. Type tailoring has emerged as a theme across several languages and metaprogramming systems, but never with direct support and rarely in the same shape twice. For example, both OCaml and Typed Racket enable forms of tailoring, but in quite different ways. This paper identifies key dimensions of type tailoring systems and tradeoffs along each dimension. It demonstrates the usefulness of tailoring with examples that cover sized vectors, database queries, and optional types. Finally, it outlines a vision for future research at the intersection of types and metaprogramming.
AB - Type systems evolve too slowly to keep up with the quick evolution of libraries – especially libraries that introduce abstractions. Type tailoring offers a lightweight solution by equipping the core language with an API for modifying the elaboration of surface code into the internal language of the typechecker. Through user-programmable elaboration, tailoring rules appear to improve the precision and expressiveness of the underlying type system. Furthermore, type tailoring cooperates with the host type system by expanding to code that the host then typechecks. In the context of a hygienic metaprogramming system, tailoring rules can even harmoniously compose with one another. Type tailoring has emerged as a theme across several languages and metaprogramming systems, but never with direct support and rarely in the same shape twice. For example, both OCaml and Typed Racket enable forms of tailoring, but in quite different ways. This paper identifies key dimensions of type tailoring systems and tradeoffs along each dimension. It demonstrates the usefulness of tailoring with examples that cover sized vectors, database queries, and optional types. Finally, it outlines a vision for future research at the intersection of types and metaprogramming.
KW - Macros
KW - Metaprogramming
KW - Partial Evaluation
KW - Types
UR - https://www.scopus.com/pages/publications/85204973409
UR - https://www.scopus.com/pages/publications/85204973409#tab=citedBy
U2 - 10.4230/LIPIcs.ECOOP.2024.44
DO - 10.4230/LIPIcs.ECOOP.2024.44
M3 - Conference contribution
AN - SCOPUS:85204973409
T3 - Leibniz International Proceedings in Informatics, LIPIcs
BT - 38th European Conference on Object-Oriented Programming, ECOOP 2024
A2 - Aldrich, Jonathan
A2 - Salvaneschi, Guido
PB - Schloss Dagstuhl- Leibniz-Zentrum fur Informatik GmbH, Dagstuhl Publishing
T2 - 38th European Conference on Object-Oriented Programming, ECOOP 2024
Y2 - 16 September 2024 through 20 September 2024
ER -