
Hi Gordon,
The do and let notations are general tools for monads - if you need exception propagation only, there is another utility for that in metamonad: the try_ template (http://abel.web.elte.hu/mpllibs/metamonad/try_.html). Instead of writing
template<class T1, ..., class Tn> struct my_metafunction : body {};
you write
template<class T1, ..., class Tn> struct my_metafunction : try_<body> {}; and it instruments body to propagate errors. If body calls another metafunction then does that one have to be instrumented too?
Yes. If body calls another metafunction, that has to be instrumented too (or be prepared for handling exceptions). When a metafunction "throws" an exception, every metafunction in the "call-chain" needs to be instrumented until the point the exception is handled. When an exception is propagated to a metafunction that is not instrumented, it causes a compilation error. Instrumentation guarantees that no metafunctions in the instrumented expression are called with exceptions as their arguments. Regards, Abel