10.8. SummaryWe hope this chapter has brought you a new perspective on library design. The most effective libraries provide users with a new level of expressiveness, one that allows them to program in terms appropriate to their problem domain. Although historically the introduction of new idioms and syntax to any programming environment has been viewed with (sometimes justifiable) suspicion, the practice has also been shown to have immense power to simplify programs and speed their development. Thinking in terms of domain-specific languages provides a foundation for library design choices, and helps us to judge which kinds of new programming idioms and syntax will be effective. By relying on those that are most evocative of existing domain abstractions and notation, we can write programs that seem to directly express our intentions. A unique combination of featuresamong them flexible operator overloading syntax, a high level of abstraction with little or no performance penalty, and the power of template metaprogramminggives C++ programmers unmatched power to build efficient, expressive DSELs. Moreover, because DSELs are libraries, users can freely combine DSEL capabilities in the same application without ever leaving a familiar programming environment. The purely compile-time MPL constructs that occupy most of this book and the techniques we covered in Chapter 9 for interfacing compile-time and runtime code are an effective toolbox for DSEL construction. In the next chapter, we'll go through an example to see just how that can be done. ![]() |