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 条
  • [1] Persistent Asynchronous Adaptive Specialization for Generic Array Programming
    Clemens Grelck
    Heinrich Wiesinger
    [J]. International Journal of Parallel Programming, 2019, 47 : 164 - 183
  • [2] Persistent Asynchronous Adaptive Specialization for Generic Array Programming
    Grelck, Clemens
    Wiesinger, Heinrich
    [J]. INTERNATIONAL JOURNAL OF PARALLEL PROGRAMMING, 2019, 47 (02) : 164 - 183
  • [3] Generic Algorithm for Generalized Fractional Programming
    Chen, H. J.
    Schaible, S.
    Sheu, R. L.
    [J]. JOURNAL OF OPTIMIZATION THEORY AND APPLICATIONS, 2009, 141 (01) : 93 - 105
  • [4] Generic Algorithm for Generalized Fractional Programming
    H. J. Chen
    S. Schaible
    R. L. Sheu
    [J]. Journal of Optimization Theory and Applications, 2009, 141 : 93 - 105
  • [5] Generic specialization
    Wright, M
    [J]. EDN, 2002, 47 (26) : 22 - 22
  • [6] A generic framework for specialization
    Thiemann, P
    [J]. PROGRAMMING LANGUAGES AND SYSTEMS, 1998, 1381 : 267 - 281
  • [7] GENERIC PROGRAMMING
    MUSSER, DR
    STEPANOV, AA
    [J]. LECTURE NOTES IN COMPUTER SCIENCE, 1989, 358 : 13 - 25
  • [8] Generic Component: A Generic Programming Approach
    Chen Yewang
    Jiang Zhixiong
    Zhao Wenyun
    Peng Xin
    [J]. 2007 CIT: 7TH IEEE INTERNATIONAL CONFERENCE ON COMPUTER AND INFORMATION TECHNOLOGY, PROCEEDINGS, 2007, : 87 - 92
  • [9] Fundamentals of generic programming
    Dehnert, JC
    Stepanov, A
    [J]. GENERIC PROGRAMMING, 2000, 1766 : 1 - 11
  • [10] Staged generic programming
    [J]. Yallop, Jeremy, 1600, Association for Computing Machinery (01):