| benlast ( @ 2004-07-29 09:01:00 |
| Current mood: | |
| Current music: | 9 Beet Stretch |
I Counted Them All Back In...
A while ago I mused on programming languages (as programmers are wont to do), and concluded that the best thing about languages like Python (and, I now admit, Java) is the freedom from all the hideous memory management that Some Other Languages have to do.
Raymond Chen's blog has an interesting example of querying information from an Explorer window. Interesting not for the way in which it introspects down through the multiple-interface objectery[1] of Windows to get at the data, but because it exemplifies, for me, the reasons I dislike C++, and Windows C++, so much.
Take a look (should you feel like it) at his final example (at the end of that page). He excuses the ugliness by saying "because I put everything into one huge function instead of breaking them out into subfunctions", and indeed, this is partly an excuse. But look at the actual code; that ever-deepening cascase of nested ifs matched by the sudden flurry of CoTaskMemFree and Release calls. I have to wonder how much simpler this would be in a dynamic language, with grown-up memory management. But, as Raymond often points out, that's legacy for ya.
The syntax of C++ also grates, after a good couple of years now with the simpler, more streamlined Python; stuff like if (SUCCEEDED(pwba->QueryInterface(IID_ISer
But then I'm a curmudgeonly old Hector at the best of times...
[1] I don't know if this is a real word, but it should be, shouldn't it? Like an orangery is to oranges.