Entries from May 2007 ↓

Hello, World

I mean, g’day Planet.

Hi. I’m Nigel Tao. You might know me from such GNOMEly things as:

I would like to echo Prashanth Mohan’s recommendation of Rob Pike’s Newsqueak talk (and the elegance of the Sieve of Eratosthenes program). Also, there are many more Google Tech Talks, where all sorts of interesting (and not so interesting) technical people drop by Google HQ and, uh, talk. For example, Aza Raskin of Humanized gave one recently titled Away with Applications: The Death of the Desktop demonstrating Enso (which I’ve previously mentioned).

Warning: this paragraph of interest to programming language buffs only :-). In Newsqueak, variable declaration looks like i: int (compared to C’s int i), and assignment is the bog-standard (although mathematically lax) i = i + 1. One cute little syntactical feature is that you can combine declaration and assignment to write i := 42 to (loosely speaking) be a short-hand equivalent to i: typeof(42); i = 42, sort of like how i += 1 is short-hand for i = i + 1. It looks like Pascal’s old-school assignment operator, but it is in fact two separate operators, and you can even put whitespace in between to get i: =42.

Finally (in the small print section), these posts are entirely my own personal opinions and do not necessarily represent the views of my employer, blah blah blah, yadda yadda yadda.

Shameless Plug (of a Memory Leak)

Superswitcher version 0.5 is out.

  • Plugged a memory leak. Previously, we were not destroying cairo contexts.
  • First draft of a D-Bus interface.
  • New add and remove workspace buttons.
  • Respects #define MAX_REASONABLE_WORKSPACES 36 as per metacity.
  • –trigger-on-caps-lock split into –also-trigger… and –only-trigger…

The memory leak turned out to be that I wrote gdk_cairo_create without having a corresponding cairo_destroy. You’d think compilers these days should be able to pick up an error like that. C++ has ‘smart pointers’ and destructors, but hot damn is it ugly. Garbage collected languages take away the problem of explicit memory management, but can be sluggish (yeah, yeah, it’s debatable), which might be quite important if you’re on limited resources.

I like C. I get it, and as far as software goes, it’s small and simple enough that I think I get all of it. I can read C, and I can understand what’s happening. Compare this to C++, where overloading and operators and multiple inheritance and references instead of pointers means that when you get an obscure bug, it hurts. Even when you have a simple bug, the compiler error messages are horrendous to get your head around. Apparently there’s a new C++ standard (“C++0x”, due Real Not-Soon Now) brewing that will ‘fix’ some of these problems, but I expect it to suck because they’re adding more things rather than taking stuff out. To mix metaphors, you can’t polish a backwards compatibility crutch.

Java and Python are (relatively) easy to write in, but for serious stuff, you have to “learn the architecture of the machine”, so says Samba guru Jeremy Allison. You gotta understand pointers, and that something is slow because you’re copying lots of char arrays in a dumb way. Having read what I just wrote, I am turning into such an old fart, but then again, I’m like 48 in computer years.

What I really want is a programming language that reads like Python and runs like C. That should be its mission statement: reads like Python, runs like C. Maybe I should enrol in a research degree, spend a few years inventing Yet Another Best Programming Language Ever, and whinge that nobody uses it even though it is the Best Programming Language Ever. If I do, you’ll surely hear about it. In the meantime, enjoy a less leaky window switcher.

Closing thought: what’s the biggest memory leak anyone’s ever seen? This fuzzy screenshot shows Firefox clocking over 1.5GB…