The Artima Developer Community
Sponsored Link

Python Buzz Forum
I Counted Them All Back In...

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Ben Last

Posts: 247
Nickname: benlast
Registered: May, 2004

Ben Last is no longer using Python.
I Counted Them All Back In... Posted: Jul 29, 2004 1:42 AM
Reply to this message Reply

This post originated from an RSS feed registered with Python Buzz by Ben Last.
Original Post: I Counted Them All Back In...
Feed Title: The Law Of Unintended Consequences
Feed URL: http://benlast.livejournal.com/data/rss
Feed Description: The Law Of Unintended Consequences
Latest Python Buzz Posts
Latest Python Buzz Posts by Ben Last
Latest Posts From The Law Of Unintended Consequences

Advertisement
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_IServiceProvider, (void**)&psp))) just... looks ugly (though I can still read it perfectly well), but I think it's the sheer effort required to do anything via COM and the Windows API that I remember - the slow trudge through looking up IIDs, playing with QueryInterface and trying to work out who owned what.  It was a lot of work for what was often very little effect and I don't miss it at all.

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.

Read: I Counted Them All Back In...

Topic: Gutenberg RSS Previous Topic   Next Topic Topic: PyNSource - UML Modelling Tools for Python

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use