I feel compelled to begin my BoostCon trip report with a disclaimer. I’m not only an attendee; I’m also a presenter, a member of the BoostCon planning committee, an active Boost developer, and a consultant with Boost Consulting, which makes me more than a little biased. But to paraphrase Thoreau, if I seem to boast more than is becoming, my excuse is that I brag for the C++ community rather than for myself.
“Nice to finally meet you!”
-- Frequently overheard at the registration meet-and-greet.
I’m in the dining room of the Aspen Meadows Resort, taking in the continental breakfast and a spectacular view of the valley below. It’s spring, and through the green buds of the aspen trees I can just barely make out the rushing of the Roaring Fork River far below. I feel a part of the scenery. A chipmunk sprints past me under the chairs and tables, hops up to the buffet, and starts munching granola. I chase it off, finish my breakfast, and go for a run on the trail by the Roaring Fork. The altitude gets the better of me, though. Deciding that there isn’t enough air here for what I’m trying to do with it, I hit the showers and head off to the registration and meet-and-greet.
I’ve never been one to do a lot of socializing online. Computers are my work. After a day of writing code and docs and trip reports, I get my “people fix” by turning off my computer and going to the local pub, which is why the BoostCon meet-and-greet is such a singular experience for me. Boost is a pretty tight community, but until the BoostCon meet-and-greet, that community had been “pure virtual” (heh, C++ humor). For BoostCon, people are coming from all over the world and meeting in person for the first time. I am especially pleased to finally meet Joel de Guzman, the primary author of Boost.Spirit and Boost.Fusion, and someone with whom I’ve worked closely on various projects for over 3 years. He has come all the way from the Philippines. Being the geeks that we are, we immediately immerse ourselves in a technical discussion about the next version of Boost.Spirit, to much eye-rolling by Greg Colvin. The week is off to a promising start.
“Lambda gives great demo.”
-- Scott Meyers, on the virtues (?) of the Boost Lambda Library
I take a winding footpath across an alpine meadow to the Aspen Center for Physics where I spend the morning learning about generic programming and the Boost Graph Library from Jeremy Siek. It’s always a treat to hear a topic presented by one of its foremost authorities, and Jeremy knows generic programming. With examples from the STL and his own graph library, Jeremy shows how to use generic programming techniques to make code that is reusable and efficient, and how to factor algorithmic requirements into concepts. Along the way, we learn the difference between a maze and a labyrinth. (The audience has some creative guesses: “A Minotaur!”, “David Bowie!”, but the real answer is that a maze branches and a labyrinth doesn’t—good to know if you’re writing a graph algorithm to navigate one.) Jeremy is one of the key architects of C++0x concepts, a hugely important language feature that just might do for generic programming what classes did for OOP. We hear the mantra, “Policy, not mechanism,” more than once, by which Jeremy means that concepts specify how generic algorithms and types communicate, but not how those types are implemented. At one point, Jeremy asks for a show of hands: who knows about traits and partial specialization? Every hand goes up. We certainly have a very advanced group of C++ programmers here. Jeremy winds down his talk with a graph solution to the Knight’s Tour, skipping his Kevin Bacon example. Six Degrees of Kevin Bacon is left as an exercise for the reader.
I spend the afternoon listening to the second half of Scott Meyers’ Shotgun Firehose Introduction to TR1 and Boost. Even though I already know the material Scott is presenting, he’s such an entertaining showman that the time is well-spent. While I’m there he races through discussions of function objects, bind expressions, smart pointers (“because really, you can never have too many smart pointers”), pointer containers, static assertions, the Boost Lambda Library, Boost.Filesystem, various conversion utilities, formatting utilities and Boost.Variant. A firehose is an apt metaphor. He injects all of this with his inimitable wit and straight-talk. In describing the difficulties of correctly using the Lambda Library, Scott compares it to “walking around on the top of a plateau, with a sheer drop-off on all sides. In the dark.” He also manages to get in a dig regarding Jeremy’s favorite topic: “What I like about concepts is that it adds another whole programming language to C++, which already has 3 or 4.” Jeremy isn’t the only one skewered. Scott also takes aim at the Boost build process, suggesting people use the header-only libraries because the others are too hard to work with. Ouch. The discussion about Boost.Filesystem is enlivened by Beman Dawes, the library’s author, who is in the audience. Although the filesystem library’s key design goal is to facilitate platform-independent access to files, Beman tells us that most people care less about that, and use it mostly for its clean, STL-ish interface. After the talk, I tell Scott that we should have conferred because there is some overlap between his talk and mine. Scott’s response? “Haha! I went first. Tough luck.“ Great, thanks Scott.
Dinner is very low key at a very high end sushi restaurant with Scott and David Abrahams, where I discover that prices in Aspen are proportional to the altitude. Rather than attend Rene Rivera’s sprint to improve Boost’s testing procedures, I retire to my hotel room for some last-minute slide tweaks. Tomorrow is my big day.
“Everybody is really excited. They’re drinking lots of coffee. They’re drinking more coffee than the physicists, even, and that’s a lot.” [Editor’s Note: BoostCon ’07 was held at the Aspen Center for Physics.]
-- Erin, the on-site administrator
I’m scheduled to give my Text Processing with Boost talk this morning, so I wander over to the Physics Center early and fiddle with the projector. After succeeding in making the image even worse, I begin my 3-hour tour of the text handling utilities in Boost. Before the break, I cover Lexical_cast; String_algo, a library of string manipulation algorithms that has been proposed for TR2; Tokenizer; Format, a type-safe printf replacement built on top of IOStreams; and Regex. We take a brief detour to explore declarative programming and domain-specific languages. The room is packed, and the audience challenges me with tough questions. Once again, I’m impressed by their level of expertise. During the break, I get a breather and a new projector.
After the break, we dive into Boost.Spirit, an EBNF-like parser generator built using expression templates. I step through an example of building an infix arithmetic expression evaluator. Joel de Guzman and Hartmut Kaiser, Spirit’s primary authors, make my job easy by fielding all the hard questions. Finally, it’s time to talk about my library, Boost.Xpressive, an alternate regex library that is new in Boost 1.34. I’m very excited about my latest code, and it shows. Scott Meyers points out that the number of exclamation points per slide spikes while I’m talking about Xpressive. Guilty as charged. I wrap my session up by revealing a few hidden gems in Boost for manipulating Unicode text: iterators that do on-the-fly translation between encodings, and a UTF-8 codecvt facet for reading and writing UTF-8 IOStreams.
All talked out, after lunch I crash, missing David Abraham’s talk on Boost.Python and hybrid development. Later, I stumble into Timothy Shead’s talk on out-of-the-ordinary object models with Boost.Python. I get the basic gist, which is that, with some very clever applications of Boost.Python, C++ objects can expose an interface to Python that doesn’t correspond to their C++ interface. Timothy also reveals that Sandia National Laboratories is hiring C++ programmers (US citizens, apply now!), but I don’t get much beyond that. I’m done for the day.
For dinner, Dave Abrahams corrals us Boost Consultants at the Wild Fig restaurant to talk shop. Our business focus is shattered by Erica, our lovely Canadian server, who drives us all to distraction. Doug Gregor is so distracted, he forgets he is supposed to be running the ConceptGCC Install-fest back at the Physics Center. (ConceptGCC is Doug’s own extension to the g++ compiler that implements much of C++0x.) Erica cheerfully loans Doug her bicycle, and we all run out with our camera phones to take pictures of Doug pedaling furiously away. Dinner winds down and we leave Erica a generous tip.
“The key is to keep adding these ...’s everywhere, and eventually it will start compiling. It’s a bit like typename that way.”
-- Howard Hinnant, on getting variadic templates to compile.
Poor Jeff Garland. Yesterday, he had to present Kevlin Henney’s slides for a whole day, and today he is running another day-long session, this time on ASIO, Boost’s shiny, new networking library. His loss is our gain, I think to myself as I settle in to learn the ways of ASIO (pronounced ay-zee-oh), a library that Jeff describes as a cross-platform system OS access library. Lots of functionality could fall under such a description besides networking, such as asynchronous file I/O and process spawning, and all these are planned future directions for ASIO. In the first hour and a half, Jeff shows how to implement wget (a command-line tool which fetches web pages) using ASIO. I’m a complete and utter noob at network programming, and I get a little crushed under the avalanche of new concepts.
During the break, Hartmut Kaiser challenges me to write a little domain-specific language for describing container output formats for the Library in a Week project. Never one to back away from a challenge, I end up missing a good chunk of Jeff’s ASIO presentation. Problem solved, I drift back into the real world and hear this gem from Jeff as he compares ASIO to the popular ACE library: “ACE is an open source project, so you’re free to download it, look at the source code, and be horrified.” Tell us how you really feel, Jeff. The morning ends with a flurry of excitement from the audience about building a library of network protocols on top of ASIO and Boost.Spirit, an effort apparently already underway.
In the afternoon, Howard Hinnant gives us a taste of things to come with a generous helping of rvalue references. C++0x will have a new reference type that allows rvalues (unnamed temporary objects) to bind to them. (Rvalues don’t bind to boring, old, ordinary references—at least not the non-const kind.) The fallout of this seemingly trivial language change is deep and profound; it makes move semantics and perfect forwarding possible. When your objects are movable, the innards of temporary objects get shunted from here to there with nary a copy in sight. The performance wins are truly impressive. Howard tells us that if he can’t get more than a 2x speed-up by making a type movable, he’s disappointed. The forwarding problem refers to the difficulty making one function pass its arguments to another unchanged, be they lvalues or rvalues. In today’s language, a function that forwards N arguments requires no less than 2N overloads to account for all the permutations of const and non-const references. But when using rvalue references, the 2N overloads collapse down to just one! Great. I need this yesterday.
Tonight is the keynote address, so I hurry back from dinner to the physics center. By the time I get there, Sean Parent is well into his talk, decrying the evils of imperative programming, glue code, Apple’s broken implementation of Model-View-Controller, O(N2) algorithms and general programmer ignorance, ineptitude and laziness. After making his point with a particularly nasty example from Adobe Photoshop’s GUI, Sean describes what a possible solution may be, in the form of Adobe’s own Adam and Eve libraries, part of the Adobe Source Libraries freely available at http://opensource.adobe.com. They provide a little declarative domain-specific language for describing the relationships between UI elements and wiring them up to dialogs. Behind the scenes is a constraints propagation engine that uses some algorithms from ad-hoc networking theory to satisfy the constraints in the model in linear time. Clean, efficient, and reusable—nice! After the talk, we retire to the bar, where Sean regales us with stories about Alexander Stepanov, the author of the STL and Sean’s most illustrious direct report. The stories mostly involved some variation of Alex telling Sean that he’s wrong. Very entertaining.
“The men don’t know, but the little girls understand.”
-- Greg Colvin, channeling Howlin’ Wolf
This morning, I publicly unveil Boost.Proto, a new library I’ve been developing to help with the implementation of domain-specific embedded languages (DSELs) like Boost.Spirit. It’s a DSEL for defining other DSELs. (Because if implementing a DSEL in C++ is hard, clearly the solution is another DSEL. Ahem.) Considering the loopy and esoteric nature of the subject matter, I had concerns: Would people get it? Would they care? But my concerns were unfounded. This group eats templates for breakfast, and they seem genuinely interested in learning how the next generation of libraries like Boost.Spirit and Boost.Xpressive are being built, and how they can build their own. It was timely, too, because next up is Hartmut Kaiser and Joel de Guzman to talk about Spirit-2, the next version of Boost.Spirit, which is built on top of Boost.Proto.
I’m doubly-glad I went first, because Hartmut and Joel blow the room away. Spirit-2 is the next-generation parser generator for C++. It’s a fully attributed, LL(inf), recursive-descent parser implemented with expression templates to approximate the syntax of EBNF directly in C++. The “fully attributed” part is new—it means that every parser has an “attribute”—kind of like a return value. You can build surprisingly rich parsers without the need to specify semantic actions—just use the parser’s attributes. Joel implements a simple XML parser for us, and the code is simple and clean, with hardly any nasty semantic actions in sight. Also new is Boost.Karma, an output generator from Hartmut Kaiser which is the yin to Spirit’s yang. If you use Spirit to parse text into a structured data structure, you can use Karma to turn the data structure back into text, in a format of your choice. The talk goes 20 minutes over, but nobody seems to care.
The rest of the day is a bit of a blur. Has the Spirit-2 talk overloaded my circuits? Have I blown a fuse? Doug Gregor’s talk about about evolving C++ libraries to use C++0x concepts goes by in a flash. Sean Parent’s talk on concept-based runtime polymorphism registers, but barely. He’s extolling the virtues of the Boost.Any technique of capturing static type information and erasing it behind a runtime polymorphic interface. Functionally, it’s a bit like interface inheritance, but post hoc and without the nasty tight coupling or reference semantics. The technique isn’t new (it’s akin to structural subtyping or duck typing, as in “walks like a .., talks like a ...”), but by using concepts, Sean makes it a bit more rigorous.
Tonight is the first annual BoostCon Picnic, and I tuck into a big pile of ribs. Programmers usually mix like oil and water, but at this point in the week, we’re nearly all on a first name basis, so the atmosphere is casual and relaxed. The beer helps. Greg Colvin and Dave Abrahams break out their guitars and run through a few old blues classics. Greg, it turns out, is a backdoor man, and Dave has the keys to the highway. Who knew? While we listen, the shadows lengthen and the sun sets over the mountains, and so ends the last evening of BoostCon ’07.
... And Back Again
I get up early, pack my bags for the journey home and drop them off at the reception center. One last continental breakfast in the Aspen Meadows dining room, taking in the beautiful greenery below, and then I’m off to the Physics Center for the final sessions of BoostCon ’07. There, Dan Marsden from the UK gives a nice overview of Boost.Fusion, a containers and algorithms library for heterogeneous sequences such as tuples. Fusion has long been part of Boost.Spirit, but in the next major release of Boost, Fusion will be a complete library in its own right, spun off like “Frasier” from “Cheers”. In anticipation of its new role as a leading-man, Fusion received a face-lift, and Dan gives us a run-through of the much improved Fusion-2. No longer restricted to tuples, Fusion now provides a gaggle of data structures—lists, vectors, maps and sets—as well as algorithms, all with semantics that should be familiar to STL users. But unlike the STL, which is restricted to sequences of same-type elements, Fusion containers can hold objects with mixed types. This sort of thing is extremely useful when writing meta-programs, even for simple things like iterating over the members of a struct and doing something to each, like serializing them into XML.
The final session of BoostCon’07 is “The Future of Boost,” a chance to pepper the moderators—Dave Abrahams, Beman Dawes, Jeff Garland, and Douglas Gregor—with questions. Dave swears up and down he has nothing prepared and nothing to say, but holds forth at length about where Boost has come from and where it’s going. It’s good information; the most noteworthy announcement is that Boost may in the near future join the Software Freedom Conservancy, an umbrella organization of Free and Open Source Software projects. The Conservancy gives free financial and administrative services to its members, which include such projects as Mercurial, Wine and Samba. As a member, Boost.org would finally be able to accept donations and use the money to plan future events such as BoostCon, and also to pay for much needed infrastructure.
The rest of the discussion centers around how best to manage Boost’s growth, which is a good sort of problem, but a problem nonetheless. After the long and painful experience of trying to release Boost 1.34 (we were in code freeze for a year!), everybody agrees that changes are needed. Up for discussion are the release procedures, the testing procedures, documentation, development and version control, and the build system—basically everything—all of which are creaking under the immense strain of Boost’s phenomenal growth. As Fred Brooks once pointed out, and as many have done since, managing a software project is inherently hard. The Answer, if one exists, eludes us for the time being, but there are some smart people here applying their big brains to the problem, so with any luck, we won’t have to wait too long to see version 1.35. Fingers crossed.
And then it’s over! After some mingling and loitering, people wander off, pile into their rental cars, point them down the mountain and set off for home. I have one last, overpriced pizza in town with some of the attendees and then head down the mountain myself, sad to be leaving the beautiful and peaceful Aspen Meadows behind. Time to get back to the real world and begin work on Boost 1.35!
Farewell, until next year.
The Libraries at Boost:
Eric Niebler is an independent C++ consultant currently working with Dave Abrahams and Boost Consulting. Formerly of Microsoft Research, Eric has also written template libraries for Visual C++ and is an active contributor to Boost.org. When not writing C++ for a living, he can often be found in coffee shops around Seattle writing C++ for fun.