# Monday, May 31, 2004

Friday morning at Tech Ed I was talking to some folks on the C++ team about the language changes that are coming for C++ and what they really mean. I don't mean that “ref class” means a class whose memory is managed by the runtime. I mean “what is the importance to a language of its syntax, and of changes to that syntax?“ How does changing a language affect the community of people who are using that language?

Managed Extensions for C++ was an attempt to bring the CLR to C++ without changing the syntax of C++. It had the side effect, in my opinion, of changing the spirit of C++, of preventing you from writing “real“ C++ for the CLR. The new language, to be known as C++/CLI, changes the syntax, but oddly enough that makes writing C++ for the CLR more C++-like than ever.  The idioms, the ways of thinking, the patterns of development, transcend the syntax. We get destructors, we get templates, we get type-agnostic code. I want this new syntax to be widely accepted, and for people to move to .NET without leaving C++ for C#. I want this partly for selfish reasons, of course: there's value in being a C++ expert only as long as there are other C++ programmers doing my kind of work. Otherwise I'm just the last person to see the light and move to C#. But I also truly believe that if you've gone to the trouble of learning C++ (and really learning it, so you like templates and destructors and operator overloading and the like) then you are foolish to wander away from that and learn a different, less powerful language. You can't beat C++ for interop, and it's a first-class CLR language for libraries, services, and other back end work. Front end work is tough because certain product teams haven't built C++ wizards and designers, but it's not impossible. I for one am agitating for wizards and designers that support C++ and I'll report back as I make progress there.

To me, this is a turning point for C++, a chance for people who rejected the framework to stick with C++ or rejected C++ to go to the framework to get the best of both worlds. But I know that there's a limit to how many times you can change a language, and if this version is as poorly-liked as Managed Extensions, times will not be happy. The good news is I like C++/CLI a lot, and believe it will succeed as a language to bring .NET to C++ and C++ to .NET.

Who else feels the way I do? Stan Lippman, for one. He says “I personally guarantee that anyone that feels passionate about C++ will be both delighted by and engaged with the C++/CLI language that will be shipped with Visual Studio 2005.“ You might feel that “delighted“ is a bit strong, but wait till you see for yourself. And if you hate Managed Extensions, you'll chuckle to read how he feels about them. 

How can you learn more? I have an upcoming codeguru article on the syntax. Herb Sutter had a horrible timeslot at TechEd to talk about this, but you can find the slides at http://216.55.155.2/docserver/slides/DEV333_Sutte%20v3.ppt (I think you need to be a TechEd attendee to log in.) There are links all over http://msdn.microsoft.com/visualc/ as well. I am indeed delighted with the new syntax (am I hopeless or what, but I actually laughed with happiness when I saw how properties are done now,) and I hope you will be too -- for my sake and yours.

If you're working in C++ now but you're not working on the CLR, should you learn Managed Extensions -- the __gc stuff -- or wait for Whidbey? I guess I'll say get a copy of the Community Technical Preview (it's still pre-beta) and start learning Whidbey/2005 syntax now. If you are using __gc now, get ready for things to be a whole lot nicer really soon.

Kate

Monday, May 31, 2004 1:34:37 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [1]