Algorithm specialization in generic programming

被引:2
|
作者
Jaervi, Jaakko [1 ]
Gregor, Douglas [2 ]
Willcock, Jeremiah [2 ]
Lumsdaine, Andrew [2 ]
Siek, Jeremy [3 ]
机构
[1] Texas A&M Univ, College Stn, TX 77843 USA
[2] Indiana Univ, Bloomington, IN 47405 USA
[3] Rice Univ, Houston, TX 77251 USA
关键词
languages; theory; generic programming; parametric polymorphism; constrained generics; concepts; specialization;
D O I
10.1145/1133255.1134014
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Generic programming has recently emerged as a paradigm for developing highly reusable software libraries, most notably in C++. We have designed and implemented a constrained generics extension for C++ to support modular type checking of generic algorithms and to address other issues associated with unconstrained generics. To be as broadly applicable as possible, generic algorithms are defined with minimal requirements on their inputs. At the same time, to achieve a high degree of efficiency, generic algorithms may have multiple implementations that exploit features of specific classes of inputs. This process of algorithm specialization relies on non-local type information and conflicts directly with the local nature of modular type checking. In this paper, we review the design and implementation of our extensions for generic programming in C++, describe the issues of algorithm specialization and modular type checking in detail, and discuss the important design tradeoffs in trying to accomplish both. We present the particular design that we chose for our implementation, with the goal of hitting the sweet spot in this interesting design space.
引用
收藏
页码:272 / 282
页数:11
相关论文
共 50 条
  • [11] Staged generic programming
    [J]. Yallop, Jeremy, 1600, Association for Computing Machinery (01):
  • [12] Staging Generic Programming
    Yallop, Jeremy
    [J]. PEPM'16: PROCEEDINGS OF THE 2016 ACM SIGPLAN WORKSHOP ON PARTIAL EVALUATION AND PROGRAM MANIPULATION, 2016, : 85 - 96
  • [13] Generic Programming in OCAML
    Balestrieri, Florent
    Mauny, Michel
    [J]. ELECTRONIC PROCEEDINGS IN THEORETICAL COMPUTER SCIENCE, 2018, (285): : 59 - 100
  • [14] Generic programming, now!
    Hinze, Ralf
    Loeh, Andres
    [J]. DATATYPE-GENERIC PROGRAMMING, 2007, 4719 : 150 - 208
  • [15] Generic programming in Ωmega
    Sheard, Tim
    [J]. DATATYPE-GENERIC PROGRAMMING, 2007, 4719 : 258 - 284
  • [16] Algebraic Specialization of Generic Functions for Recursive Types
    Cunha, Alcino
    Pacheco, Hugo
    [J]. ELECTRONIC NOTES IN THEORETICAL COMPUTER SCIENCE, 2011, 229 (05) : 57 - 74
  • [17] GENERIC FREENESS OF LOCAL COHOMOLOGY AND GRADED SPECIALIZATION
    Chardin, Marc
    Cid-Ruiz, Yairon
    Simis, Aron
    [J]. TRANSACTIONS OF THE AMERICAN MATHEMATICAL SOCIETY, 2022, 375 (01) : 87 - 109
  • [18] A generic framework for the analysis and specialization of logic programs
    Puebla, G
    Albert, E
    Hermenegildo, M
    [J]. LOGIC PROGRAMMING, PROCEEDINGS, 2005, 3668 : 407 - 409
  • [19] Generic programming within dependently typed programming
    Altenkirch, T
    McBride, C
    [J]. GENERIC PROGRAMMING, 2003, 115 : 1 - 20
  • [20] Arity-Generic Datatype-Generic Programming
    Weirich, Stephanie
    Casinghino, Chris
    [J]. PLPV'10: PROCEEDINGS OF THE 2010 ACM SIGPLAN WORKSHOP ON PROGRAMMING LANGUAGES MEETS PROGRAM VERIFICATION, 2010, : 15 - 26