|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?FreeOZ用户注册
x
The Removal of Concepts From C++0xLast updated Jul 17, 2009.
On Monday, July 13th 2009 Concepts were dramatically voted out ofC++0x during the C++ standards committee meeting in Frankfurt. Thisshocking news raises many questions and concerns. Unquestionably, thesewill be discussed in various forums in coming weeks and months.However, I will try to answer three burning questions here: What led tothe failure of Concepts? How will the removal of Concepts affect C++0x?Will Concepts make a comeback in the near future?
The Writing on the WallWhen I first heard the news, I couldn't believe it. Conceptswere supposed to be the most important addition to core C++ since 1998.Tremendous efforts and discussions were dedicated to Concepts in everycommittee meeting during the past five years. After dozens of officialpapers, tutorials and articles -- all of which were dedicated topresenting and evangelizing Concepts -- it seemed very unlikely thatjust before the finishing line, Concepts would be dropped in a dramaticvoting. What caused this change of heart among committee members?
Early warning signs emerged long ago. Initially, Concepts weresupposed to be integrated into the Standard Library. However, the C++0xCommittee Draft (approved in September 2008) didn't include aconceptualized Standard Library. Committee members claimed that it wastoo early to adopt such a radical change to the Standard Librarywithout real world experience. Apart from that, there were still toomany unresolved issues. As a compromise, the committee decided topursue the refinement of Concepts while leaving the Standard Libraryunconceptualized for the time being. This was an ominous sign -- if thecommittee is wary of conceptualizing the Standard Library, why shouldJoe Code trust Concepts?
Two strong undercurrents shook and undermined the entire Conceptsfoundation. First, skepticism regarding the feasibility and usefulnessof concepts intensified the antipathy towards this proposal. Somepeople expressed concerns about compile-time and runtime overhead.Second, the creators of the Concepts proposal tried desperately toimprove and patch Concepts. The last nail in the coffin was BjarneStroustrup's paper "Simplifying the Use of Concepts"from June. It's a masterpiece in terms of presenting Concepts but italso scared folks. The general sense was that concepts were broken, thecommittee was not sure what the correct direction was to fix them, andit would probably take several more years to come up with a reasonablefix that would achieve consensus. Considering that Concepts wereoriginally designed to simplify C++, a critical mass of committee members agreed in July 2009 that it was time to bid Concepts goodbye.
Possible DirectionsIt's still unclear at the time of writing which alternatives thecommittee will choose. A total overhaul of Concepts is one possibility,however unlikely. This could take up to five years and no one iscertain that the redesigned Concepts will not have introduced otherproblems. A second approach is to leave the door open for a drasticallyreduced and diluted Concepts proposal. The third approach is to refinethe current Concepts proposal further, knowing that it will not beintegrated into C++0x. I'm willing to bet on the following -- Conceptsare dead for good. The Concepts proposal was doomed because thecommittee wasn't standardizing existing practice (which is what itusually does) but instead, invented a huge, complex and controversialfeature ex nihilo. History shows that features that were added in thisunusual way to C++ have all failed. This was the case with exception specifications and exported templates.
Implications and AnalysisIt's hard to tell at this stage how the removal of Concepts willaffect C++0x. Clearly, the impact will be huge because many other C++0xfeatures presuppose Concepts. In the coming weeks, the committee willhave to scrutinize all outstanding proposals and the Committee Draft toassess the impact of this decision.
How will C++0x programming and design look like without Concepts?Brace yourself for many more years of indecipherable templatecompilation errors. Additionally, type traitswill become a hot commodity once again. Presently, type traits are oneof the very few proven techniques for enforcing compile-timeconstraints on templates. Pedagogically, C++ will be a tad easier toteach.
The removal of Concepts paves the way to other radical changes. IfConcepts could be removed, there's no reason why other "safe" featuresshould become sacred cows. No, I'm not going to name such features butsuffice it to say: the Committee Draft has plenty of features that needto be reconsidered or dropped.
The collapse of Concepts might seem as a sad end to a well-intendedattempt to solve a fundamental problem. However, there's no reason forsobbing. This story shows that the committee isn't afraid to take toughdecisions if it has to. It's also a good reminder to all programminglanguages' designers: don't get enamored of your own proposals. Everynew proposal seems neat and promising at first but after a fewiterations and redesigns, it might easily turn into a bloated tumorthat impedes the natural growth and evolution of the language(namespaces anyone?). If we're ever going to have concepts in C++, it's"the marketplace", not the committee, that needs to do its work firstand only then should the committee bless the result -- if it sochooses. Doing things the other way around is a recipe for failure.
|
|