C++Now 2014 has ended
Please visit the C++Now website.
Back To Schedule
Thursday, May 15 • 11:00am - 12:30pm
Interactive Metaprogramming Shell Based on Clang

Log in to save this to your schedule, view media, leave feedback and see who's attending!

Developing metaprograms is hard and painful. Templight (http://plc.inf.elte.hu/templight/) supports the development and debugging of template metaprograms, but the code has to be recompiled after every minor change and tricks are needed to retrieve useful information about the result.

A number of languages (Python, Haskell, Erlang, etc) provide an interactive shell for trying code out and displaying the results immediately. For example adding a new element to a list and displaying the result in a Python shell is an easy thing to do:

> l = [2, 3, 4]
> l.insert(0, 1)
> l
[1, 2, 3, 4]

The shell can display the result immediately. The developer does not need to compile his code and start up a debugger to see the result of an expression.

This talk presents Metashell, which is an interactive shell for template metaprogramming. It provides a testing and development environment for template metaprogramming which is as easy to use as a Python shell. For example one can do the following:

> #include <boost/mpl/vector.hpp>
> #include <boost/mpl/push_front.hpp>
> #include <metashell/formatter.hpp>
> using namespace boost::mpl;

> push_front<vector<int, char>, double>::type
boost_::mpl::vector<double, int, char>

The shell displays the result of a template metafunction.

Metashell is available here: https://github.com/sabel83/metashell. One can try it online in a browser as well: http://abel.web.elte.hu/shell. Metashell is based on the libClang library.

avatar for Ábel Sinkovics

Ábel Sinkovics

Morgan Stanley
Ábel Sinkovics is a software developer and has defended his PhD in January at Eötvös Loránd University, Budapest, Hungary. His research is about C++ template metaprogramming, functional programming and domain-specific languages. He has been building libraries supporting domain-specific... Read More →

Thursday May 15, 2014 11:00am - 12:30pm MDT

Attendees (0)