What are concepts? And what is C++0x?
C++0x is (in addition to being the worst name ever for anything) the next standards update to C++. It endeavors to add more to C++, not because C++ needs to be more complicated (which it already is, and which it will become more so), but to try and add some badly missing features to make C++ competitive with higher level languages.
Bjarne has a FAQ page.
Let's fisk the individual features he comments on:
- "auto" keyword - good, D had this since version 1
- for(auto x : container) - good, wordier than D version 1
- fix for template<nested<>> - good to see this fixed, sorry for compiler and tool writers who need to make it work
- default and delete - meh
- enum class - good (if oddly named), D version 1
- constexpr - good, D "pure" functions (maybe not until version 2) are more powerful
- decltype - meh, I believe D has better introspection with typeof(?), etc.
- initializer lists - not sure how much of a win this is, adds a lot of complexity. Built-in array types seems a better (simpler) solution
- preventing narrowing - meh
- delegating constructors - good, D version 1
- in class member init - yeah!, D version 1
- inherited constructors - meh
- compile time assert - D version 1 (plus contracts are way better)
- long long - ugh, why not standardize on int64_t?
- nullptr - ugly name, D version 1 has null
- suffix return type - "[] mul(T x, U y) -> decltype(x*y)" ahhh!!!!! that looks like ML or something else that Cthulhu would write
- template alias - meh
- variadic templates - much needed, although more complicated templates makes my head want to explode
- more initialization syntax - cause more is better
- rvalue references - wow, that is some ugly syntax. All hail swap!
- union fixes - "s.~string();" nuff said
- POD - meh
- raw strings - meh
- user defined literals - wow, I mean wow. Why? 'constexpr complex<double> operator "i"(long double d)' Why? Please, why?
- attributes - seems good
- lambda - yea! D version 1
- local types as template arguments - never ran into this bug, good to see it fixed
- C99 - meh
- extended integer - why wasn't <stdint.h> enough?
- extern templates - this is how some early template implementations worked, maintenance headache
- std::array - D version 1
- unique_ptr - nice
- concepts - this would be nice. Much closer to what Java allows for its (much weaker) version of templates.
- More. More. More. It's all complexity-plus-plus. More complicated compiler, more bugs, more complicated IDE, more to learn, more to remember, more to code. Maybe a little less to code, sometimes. Ugh.
- A lot of this is no longer looking like C. What is some embedded guy who misses this update going to think when he sees this code? He'll have no idea what is going on.
- How long before I can actually use this stuff? Sure, g++ will have it quickly... MSVC will probably take 3-5 years after the standard (because they will keep trying to push their incompatible version). What about dmc? Or weird embedded compilers whose vendors have gone out of business? Oh, they'll never have this... which means, I shouldn't be using it if I need to be cross compatible. Which means I can't use it for the next 10 years.
- All this to get what D had in version 1. D version 2 will be done in the next year, and usable from day 1.
No comments:
Post a Comment