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 条
  • [41] STL and generic programming: STL algorithms
    Becker, Thomas
    [J]. C/C++ Users Journal, 2002, 20 (04):
  • [42] Comparing Libraries for Generic Programming in Haskell
    Rodriguez, Alexey
    Jeuring, Johan
    Jansson, Patrik
    Gerdes, Alex
    Kiselyov, Oleg
    Oliveira, Bruno C. D. S.
    [J]. ACM SIGPLAN NOTICES, 2009, 44 (02) : 111 - 122
  • [43] Generic Programming with Extensible Data Types
    Hubers, Alex
    Morris, J. Garrett
    [J]. PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL, 2023, 7 (ICFP):
  • [44] A Generic Dynamic Programming Matlab Function
    Sundstrom, Olle
    Guzzella, Lino
    [J]. 2009 IEEE CONTROL APPLICATIONS CCA & INTELLIGENT CONTROL (ISIC), VOLS 1-3, 2009, : 1625 - 1630
  • [45] Synthesis of Functions Using Generic Programming
    Koopman, Pieter
    Plasmeijer, Rinus
    [J]. APPROACHES AND APPLICATIONS OF INDUCTIVE PROGRAMMING, 2010, 5812 : 25 - 49
  • [46] Comparing approaches to generic programming in Haskell
    Hinze, Ralf
    Jeuring, Johan
    Loeh, Andres
    [J]. DATATYPE-GENERIC PROGRAMMING, 2007, 4719 : 72 - +
  • [47] Essential language support for generic programming
    Siek, J
    Lumsdaine, A
    [J]. ACM SIGPLAN NOTICES, 2005, 40 (06) : 73 - 84
  • [48] Towards generic programming with sized types
    Abel, Andreas
    [J]. MATHEMATICS OF PROGRAM CONSTRUCTION, 2006, 4014 : 10 - 28
  • [49] Generic process algebra: A programming challenge
    Ribeiro, Paula R.
    Barbosa, Marco Antonio
    Barbosa, Luis Soares
    [J]. JOURNAL OF UNIVERSAL COMPUTER SCIENCE, 2006, 12 (07) : 922 - 937
  • [50] Prototyping generic programming in Template Haskell
    Norell, U
    Jansson, P
    [J]. MATHEMATICS OF PROGRAM CONSTRUCTION, PROCEEDINGS, 2004, 3125 : 314 - 333