31 May 2006 ingvar   » (Master)

Sometimes, I miss "proper macros". A lot. I'm trying to get an old stinker of a project done and dusted (it's essentially a re-write, in another language, of an older project; but back-ending onto a database, with only a client/server approach as opposed to the "same, almost, API; either local library modifying back-end straight or clients/server via network"). OK, I am moving teh project from C to Python (notice that "database backend"? that'd be why).

But as part of the new rewrite, I want to have some sensible exception/error handling and to my mind that means handling different types of errors differently (it's basically a workflow system and map errors, user-related errors and item-related errors are all fundamentally different). But, alas, this means I end up writing several lines of almost-duplicate code (class declaration differing in only class name; __init__ declaration identical; __init__ body, differing in one string).

It feels horribly inefficient and should, probably, have been compressable with either a code generator (free-standing from the rest of the code, requires a separate phase to run) or by a sufficiently flexible macro system.

But! I shall persevere! It is good for the soul (hah, I'm not even fooling myself) to experience pain. I guess I could the pre-existing code away and rewrite everything from scratch (OK, not the db schema, I'm sufficiently happy with that). But that'd be, like, a pain too.

Latest blog entries     Older blog 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!