11.7. Language DirectionsAlthough as of today C++ is the most suitable language for building highly efficient DSELs, there is still a lot of room for improvement. As you've seen, the DSELs you can implement within the current language are amazing, but they also require an amount of work that becomes justifiable only if you are really planning to spend a lot of time working in the DSEL's problem domain. Moreover, despite the richness and flexibility of C++'s operator overloading rules, one often has to settle for less-than-perfect syntax. What seems to be liberal in the domain of general-purpose programming is often not quite liberal enough to conveniently express the syntax of an arbitrary domain. Things don't have to be that way, of course. While C++ will probably never allow arbitrary syntax extensions, a few small changes to the language would improve DSEL writing a great deal. One problem we saw in this chapter is that although the language's runtime syntax is incredibly rich, once we cross the boundary into runtime by passing a constant (in our case, a member function pointer) to a function, it's impossible to get that constant back into the compile-time world as metadata. For example, if we could expand the language's ability to do "constant folding," it could be possible to leverage its rich runtime syntax in contexts that require pure metadata [n 1521]. |