Functional Metaprogramming in C++ and Cross-Lingual Development with Haskell

Haeri, Seyed Hossein;Schupp, Sibylle;Huser, Jonathan
(2011) 23rd Symposium on Implementation and Application of Functional Languages — Location: Lawrence, KA, USA (3.October.2011)

Files

IFL11Post.pdf
  • Open Access
  • Adobe PDF
  • 189.01 KB

Details

Authors
  • Haeri, Seyed Hosseinorcid-logoUCLouvain
    Author
  • Schupp, SibylleHamburg University of Technology, Germany
    Collaborator
  • Huser, JonathanHamburg University of Technology, Germany
    Collaborator
Abstract
Template and Preprocessor Metaprogramming are both well-known in the C++ community to have much in common with Functional Programming (FP). Recently, very few research threads on underpinning these commonalities have emerged to empower cross-development of C++ Metaprogramming (C++MP) and FP. In this paper, we program a self-contained real-world example in a side-by-side fashion to explore the usefulness of a few mainstream FP languages for this purpose: We develop a compile-time abstract datatype for Rational Numbers in C++.We then present the runtime equivalent in HASKELL, F#, and Scala to discuss some FP parallels across the languages. Here, we consider semi-automatic translation between C++MP and FP languages, for earlier studies on these parallels have already obviated the unsuitability of fully automatic translations. Our study also shows superiority of multiparadigm FP languages over single-paradigm ones. In particular, we conclude Scala to currently be the most promising FP language for facilitating C++MP.
Affiliations
  • Institute for Software SystemsHamburg University of Technology, Germany

Citations

Haeri, S. H. (2011). Functional Metaprogramming in C++ and Cross-Lingual Development with Haskell. 23rd Symposium on Implementation and Application of Functional Languages, Lawrence, KA, USA. https://hdl.handle.net/2078.5/120390