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?

2: (defn bad [x]
3:   [(inc x)
4:    (subs x 1)])
6: (main [_]
7:       (bad "one")
8:       (println 'done))

In the 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 inc and 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

*** Conflicting assertions at assertion-tests/simple-conflict.toc: 4
 'Integer' from:                          'String' from:
 assertion-tests/simple-conflict.toc: 3   assertion-tests/simple-conflict.toc: 4
 $TOCCATA_DIR/core.toc: 917               $TOCCATA_DIR/core.toc: 834
 $TOCCATA_DIR/core.toc: 712
 $TOCCATA_DIR/core.toc: 118

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. :)