Friday, May 11, 2007

return, break and continue

Funny how any programmer will always tell you that goto's are evil. Ofcourse they are. But every programmer also effectively uses them all the time. The return, break and continue statements that exist in most programming languages are goto's in disguise. And good ones too. I guess they were invented when language inventors realized these represent safe usage patterns of the goto statement. Not using them will generally result in indentation bloat, because they are naturally suited to preconditions (for programming languages that don't support preconditions in the language itself, which happens to be most of them). Hence, not using them makes your code harder to read.

Ofcourse I'm right, because the zen of python clearly states "flat is better than nested" :)

If you really push it then any iteration construct itself (without break or continue) is also a goto (or even multiple goto's) in disguise, but ok, no point in going there.

the evolution towards lisp

I was discussing the "all programming languages evolve towards lisp" theory with a colleague recently. Paul Graham explains it quite well:
If you look at these languages in order, Java, Perl, Python, you notice an interesting pattern. At least, you notice this pattern if you are a Lisp hacker. Each one is progressively more like Lisp. Python copies even features that many Lisp hackers consider to be mistakes. You could translate simple Lisp programs into Python line for line. It's 2002, and programming languages have almost caught up with 1958.
But I think there is another clear sign of the evolution towards lisp. The increasing popularity, especially in the eclipse community, of code generators. Since reading 'Practical Common Lisp', it would seem silly to invent huge blobs of code generating code in Java, when the world already has the greatest code generating tool, the lisp macro.

Monday, May 07, 2007

the choice of distributed version control system

Reading about mozilla's move to mercurial, it's still not clear to me which one is best: git, mercurial, bazaar, monotone or darcs? I've happily been using subversion for quite some time, but now I feel a real need for a distributed vcs. It also feels conceptually right.

One good point made in the reasoning for mozilla's move is that it's not a disaster to make the wrong choice; all of these vcs' contain all the information necessary to convert between them. For me, win32 support is an issue, and I need a plugin for trac. Analog to TortoiseCvs and TortoiseSvn, there should be a TortoiseGit, TortoiseHg, TortoiseBzr, TortoiseMtn and TortoiseDarcs. Uhm, wait a second, there is a TortoiseDarcs! A TortoiseBzr seems to be in the works. The other tortoise's pop up on google, but with nothing substantial.

So anyway, for each of these, you can easily find people who are passionate about it. But I suspect that that's just because cvs left such huge scars on everyone. It is high time for cvs to be erased from our collective memories and start being picky about the features these new (distributed) systems have to offer.