Archive for January, 2009

Finally watched Blood Diamond this weekend. It was good actually, kind of an adventure flick but with an attempt to show some of the reality of the blood diamond trade. Of course, along side the brutal killing, child soldiers and arm chopping, Leonardo DiCaprio and Jennifer Connelly added some standard holywood magic to the whole affair; three stylists between then, made sure that hair was never out-of-place. The black African lead managed to achieve his apotheosis in the end by wearing a suit and talking to Americans (who could ask for more?). And, of course, there was a dramatic love interest to set it off. Still, it wasn’t anywhere as bad as it could have been. It did help to raise child soldiers up the agenda, it did describe how the diamond market works (or worked as it’s all different now, honest) and it was actually quite interesting. Critically important, there was no warbling in the background from Celine Dion which is guarenteed to improve any movie.

All in stark contrast to Carla’s Song which I also saw; a simple, elegant and well-told story and some excellent performances. One of Ken Loach’s more cheerful films with Robert Carlyle in his golden period, I greatly enjoyed it. If Ken Loach really wanted to change the world, he’s spice his films up a bit, like Blood Diamond, to sell to the US market, get the message in under-the-wire. I’m glad he doesn’t.

Posted by hand from my old blog site.

Lua

So, I’ve been using Lua for a couple of months now; I thought that I would learn it because it’s been ages since I learned a new language, and it’s got a reputation for being small, clean and fast.

On the whole I think it’s lives up to it’s reputation. It’s a nice langauge, leaning more toward the functional than OO, at least in the way that I write it.

Syntactically, it’s very simple and regular which is a good thing; there are a very places where I would have simplified it still further. For example, both of these are legal:

print( "hello" )
print "hello"

which is a nice syntactic short-cut, but then it only works with a single argument,

print( "hello", "goodbye" )
print "hello", "goodbye" -- ILLEGAL

Probably I would not have allowed the shortcut.

Lua has a pattern syntax for regexp-like searching, but in a desire to keep Lua small, it’s a pretty weak; more over, it’s not a standard syntax at all, and lacks familiarity. Of course, Lua makes it easy to link in a regexp library, but I think that they should have standard extensions — i.e. if you are going to link in a regexp library choose this one first. To some extent, this already happens — the Math.power function is not guarenteed to work as it forces the linking of the ansi C math library.

Almost all of Lua is based around tables — hash maps effectively — which also serve as arrays. This is okay and, of course, you can build anything you want from this; but, combined with the lack of types, I find myself asking questions like, is this a table of tables, an array of tables or a table of arrays? Too much knowledge is implicit. Table handling is also a bit limited; there’s no support for taking slices of tables (when used as an array), nor functions like "contains" or "first index".

On the whole I think it fulfils it’s purpose; it’s great for small and simple code. The worry is that people will get carried away and start writing enormous applications in it, for which it is just not suited. Small languages have a habit of becoming big. As it is, though, it serves as a nice, relatively low-level language.

Originally published on my old blog site.