Older blog entries for mwh (starting at number 167)

mikehearn's diary entries about COM have reminded me of a particular irritation I have with C.

What's a (built) C library? More or less, it's a blob of data (the most interesting of which is usually machine code) and a bunch of entry points -- indexes into this data.

This is not exactly information rich.

34. The string is a stark data structure and everywhere it is passed there is much duplication of process. It is a perfect vehicle for hiding information. -- Alan Perlis, http://www.cs.yale.edu/homes/perlis-alan/quotes.html

So, just given a C library, you don't have a hope of, say, writing Python bindings for that library. You don't know the number and types of argument the functions take (I'm not even sure you can easily tell which entry points are functions...). To get this information, you have to look at the headers, which can be more-or-less arbitrary C and so are not the easiest things in the world to parse and get useful information out of.

In a language that's less terrified of letting things happen at runtime, you can just ask.

You're never going to be able to generate wrappers totally automatically -- there's always likely to be fun with memory management -- but it could be less of a pain.

Maybe GCC-XML is the answer.

I'm not having a good day. I thought going on holiday was supposed to leave you refreshed and just dying to leap back into the daily grind. Not this time (holiday was good, mind, I'm just in a foul mood today).

So, thinks I, I'll do something useful, and make bug reports for a couple of reference leaks I've found in Python in the last week or so. And then SF falls off the net. Argh!

Lets see... going on holiday very soon. This is good.

Went to see Pirates of the Caribbean, my first visit to the cinema in months and months, and a good film to break my duck with. Johnny Depp is ... unusual, I think it would be safe to say.

Playing quite a lot of EV Override (in the EV:N TC form).

Hacking wise, still doing a bit of futzing around with Cocoa and so on. I think having an environment based on a somewhat dynamic language (Objective-C as opposed to C++ or C) is a *really* good thing, at least with computers accelerating at the rate they are. Free software should take note.

One thing that slightly stacks the deck against open source implementations of stuff like this is that the benefit of having the whole Cocoa framework around is vastly more than the sum of the benefits of having the bits of it around. The Twisted Python framework comes to mind here, but it remains biased towards networking applications (no surprise: Cocoa is biased towards GUIs, but seems a bit more generally applicable).

Maybe I should try to grok CLIM or Squeak...

29 Aug 2003 (updated 29 Aug 2003 at 12:29 UTC) »

I seem to have a knack for not doing things the easy way.

About a week ago, I started to seriously work on my learn-PyObjC project (a resource editor for EV Nova).

A few days of good progress later, it seemed like it would be helpful to write an "Interface Builder palette" in PyObjC.

*Now* I'm running Interface Builder under gdb, disassembling undocumented functions and trying to work out how PyObjC can pretend that some of the ObjC classes it creates were loaded from a Mach-O bundle when in fact they were creating dynamically by calling ObjC runtime functions.

For the first time in years, today I picked a slashdot story at random, turned the threshold down to -1 and leafed through the comments.

What a festering pile of shit.

fxn: A tweak you might want to apply to your Pythonic-indentation-to-Ruby fun is to end lines that have an INDENT after them with a colon:

So instead of displaying

def method(foo)
  if condition(foo) then
  foo.each do |bar|
    bar.each do |baz|
def method(foo)
  if condition(foo) then
  foo.each do |bar|
    bar.each do |baz|
you display it as
def method(foo):
  if condition(foo):
  foo.each do |bar|:
    bar.each do |baz|:
Apparently, this is a feature the ABC designers found significantly increased readability, and I think they got that right.

criswell: I think Guido is my favourite "Open Source luminary", at least partly because he doesn't really seem comfortable with being one :-)

18 Aug 2003 (updated 18 Aug 2003 at 14:48 UTC) »

As Jarno has been pointing to my quotation collection again and mentioning his favourites, it seems fitting to point out some of my own.

I think the reason I like some of these is almost entirely down to rhythm:

  I would hereby duly point you at the website for the current pedal
  powered submarine world underwater speed record, except I've lost
  the URL.                                         -- Callas, cam.misc
I mean, it's kind of amusing in a random sort of way, but something about the flow of it really appeals to me.
[1] If you're lost in the woods, just bury some fibre in the ground
    carrying data. Fairly soon a JCB will be along to cut it for you
    - follow the JCB back to civilsation/hitch a lift.
                                               -- Simon Burr, cam.misc
Just funny. We had a network-outage-through-JCB event recently, which helps, I guess.
  Monte Carlo sampling is no way to understand code.
                                  -- Gordon McMillan, comp.lang.python
A bit of wit & wisdom.
  I located the link but haven't bothered to re-read the article,
  preferring to post nonsense to usenet before checking my facts.
                                      -- Ben Wolfson, comp.lang.python
An honest post!
  Gevalia is undrinkable low-octane see-through only slightly
  roasted bilge water. Compared to .us coffee it is quite
  drinkable.                                      -- Måns Nilsson, asr
Rhythm again, although much as I like coffee I do find over done coffee snobbery a bit trying.

Obviously, though, I like all the quotes I have on that page & am glad others do too.

5 Aug 2003 (updated 5 Aug 2003 at 15:34 UTC) »
chromatic: While I see your point about not using XML for config files, I like the fact that for just about *any* application on Mac OS X you can just type "open /path/to/pref.plist" and hack about in Property List Editor. I don't want to have to remember what silly adhoc format any given application has chosen to use.

Actually *looking* at the XML is right out -- but that should always be the case, no?

Some of the talks at EuroPython made me a little bit more interested in XML. People obsess a bit about the angle brackets, which is missing the point. AFAICS, the right viewpoint is that it's a standard for structured data. On one level, it's not much more exciting than ASCII.

(Edit: and of course, if you're a command line junkie, there's defaults(1)).

(Edit^2: etrepum: yes, I knew that. I'm not sure what your point is. *My* point, if it wasn't clear, was that having a structured format for config files is nice, and that an XML format is a reasonable way of doing that. NeXT plists would be fine, too).

(Edit^3: retract a silly bit of Edit^2)

amk points out that my hold-checkins-from-unapproved-commiters idea would be easier to implement if we used bitkeeper or similar.

I've often thought that the bitkeeper-type model wouldn't really work for Python, as having multiple trees floating around doesn't really make sense for a programming language. I guess there could be a PythonLabs tree that releases would be made from and all the developers could work on stuff in they're own tree and share their work and so on.

I also don't know how the interface aspects of bitkeeper work. I could find out, I guess.

I don't think Python will be using a model like this any time soon :-)

Crazy thought for the day:

Quite a few patches submitted to Python are exceedingly trivial -- typos in documentation, perhaps -- and the bother of going to sourceforge, finding the patch page, downloading the patch, applying it and checking it in is just totally excessive to change 'teh' to 'the'.

So, the idea: allow *anyone* to check in to the Python repository, but arrange for checkins from people who are not anointed developers to be 'held', much like a post to a moderated mailing list. Then all a 'checkin moderator' has to do is go to some webpage (presumably), eye-ball the patch, see it's triviality and click a button to let it through.

Would this work? I think it might.

You could also allow for discussion on the patch by associating a roundup issue with each held checkin, though I'm not sure how you'd manage new versions of patches that resulted from the discussion.

158 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!