Interactive C++

The C++ programming language is used for many numerically intensive scientific applications. A combination of performance and solid backward compatibility has led to its use for many research software codes over the past 20 years. Despite its power, C++ is often seen as difficult to learn and inconsistent with rapid application development. Exploration and prototyping is slowed down by the long edit-compile-run cycles during development.

Cling has emerged as a recognized capability that enables interactivity, dynamic interoperability and rapid prototyping capabilities to C++ developers. Cling supports the full C++ feature set including the use of templates, lambdas, and virtual inheritance. Cling is an interactive C++ interpreter, built on top of the Clang and LLVM compiler infrastructure. The interpreter enables interactive exploration and makes the C++ language more welcoming for research.


Figure 1. Interactive OpenGL Demo, adapted from here.

A key enabler of innovation and discovery for many scientific researchers is the ability to explore data and express ideas quickly as software prototypes. Tools and techniques that reduce the “time to insight” are essential to the productivity of researchers. At the same time massive increases in data volumes and computational needs require a continual focus on maximizing code performance. To manage these competing requirements, today’s researchers often find themselves using a heterogeneous and complex mix of programming languages, development tools, and hardware.

Over the last decade, together with collaborators, we have developed an interactive, interpretative C++ (aka REPL) based on LLVM and clang. Amongst our research goals are to

  • Advance the interpretative technology to provide a state-of-the-art C++ execution environment,
  • Enable functionality which can provide native-like, dynamic runtime interoperability between C++ and Python (and eventually other languages), and
  • Allow seamless utilization of heterogeneous hardware (such as hardware accelerators)

Contributors