No intro this time, pithy or otherwise. If you haven't read the previous post, please do so.
Take 15 seconds to look at this program before reading on. See a problem?
bad function, the parameter
x is both incremented by 1 and has a substring extracted from it. No matter what value is passed to
bad, one of these is going to fail. Now imagine this situation occurs in the middle of a 1000 line file. And instead of
subs, the offending functions were multiple levels deeper in the call tree. What's your stack trace going to look like when this blows up? What process would you have to go through to find this? How long would it take you to correct your mental model that caused you to write something like this in the first place? What would this do to your 'flow'?
Now try to compile it with Toccata
What do you think? Better? I think so.
A personal note
Over 3 years ago, this idea came to me and was fleshed out mentally over the course of an hour or so. I already knew I wanted to create a "native Clojure". But when this hit me, I knew I had to. A mountain of work later and I finally have a concrete example to show. There are many more ideas that I've already implemented in Toccata and there are several mountains of work ahead. But this short post is a milestone. And I'm very glad to be able to finally share it.
Ok. Break time is over. On to the next task. :)