Const Correctness

I’m slipping a little on my promise to do once-a-week posts. Wait, it was biweekly, originally. Am I still good?

I’ve been working in C++ lately, which is one of those programming languages that resembles a Hutt: bloated, immobile, yet still greedy. And can be very, very powerful.

One of the core ideas of C++ was const correctness. This is one of those ideas I completely agree with in theory, but find hard to deal with in practice.

I’d love to say “this method will not modify the external state of the object”. I’d like “this collection is…

Categories and +load

If you’re a Cocoa plugin writer, sanctioned or otherwise, you’ve probably thought about categories. About how you can magically add methods to existing classes…and if you’re careful, you can replace existing methods as well. With a few caveats: you can’t call the original method, and if someone else is doing the same thing, only one of you will win. Which makes it a bad idea, at best.

Well, today I was absentmindedly reading through GCC extensions to the C languages, and came across this tidbit:

The +load is a method that is not overridden by categories. If a class…

Subversion Checksum Problems

OK, so I didn’t quite make this up in one week, but I’ll keep trying. Here’s a tip for SVN users who get the dreaded “checksum mismatch” (usually by entirely replacing a file instead of editing it or something, actually I’m not quite sure what the exact cause is). There are already a couple workarounds on the Internet, but this one’s pretty clean.

  1. cp theFile theFile.bak
    Save your changes.

  2. svn info theFile | grep "Last Changed Rev"
    This is the last time the file changed in the repository; say it’s something like 6207.

  3. svn update -r6206 theFile

Older Posts

  1. 2009-03-06 JavaScript Tetris