Saturday, May 14, 2005

Just as in the fashion industry, there are fads in programming. What was once in vogue eventually is thrown away as unproductive, too confusing, or just plain un-cool. Unlike the fashion industry, old styles don't go out with a whimper, they often go out with a bang. This is usually in the form of some vitriolic screed by the proponents of the "One New Way." Sometimes the object of derision is a big thing - like pointers, and sometimes it is a small thing - like operator overloading. A classic example of this is white space. The parallel with the fashion industry could not be more simple, since white space is entirely about how code looks. The "white space matters" paradigm was in fashion, out of fashion, and now, with Python, back in fashion. Sheesh.

Sometimes, something comes along to remind you why a feature like operator overloading, while out of fashion, is still darn cool. While complaints against operator overloading are justified in many instances, in a domain specific area such as parsing, where there are well known forms (EBNF), operator overloading can be simply sublime. The Spirit framework is just such a case. Instead of thinking of it as C++ - I think it is much better to think of it as a way to easily embed a domain specific language (DSL) right within your C++ code. If you do any C++ coding and parsing, you owe it to yourself to check it out.


Post a Comment

<< Home