quarkup and quirkywiki in Scala
A couple of years ago, I came up with yet another wiki markup syntax. I called it "quarkup". I intended (and, I suppose, still do intend) to use it in a home-grown wiki + weblog setup that I'd like to write in Scala. I wrote a quarkup-to-HTML translator in Python, as one of my first fully test-driven developments. It was fun to do and it worked out well.
So now I'm translating it into Scala. I start to get a feel for three different kinds of changes I have to make.
- I have to be explicit about a variable's type sometimes. Overall, this is an improvement. Sometimes, it leads to a radical simplification of the function I'm working with, because giving the type a name makes it more clear to me what that function is doing.
- Some missing features (e.g., the lack of optional parameters) have also led to minor simplification.
- Some stuff remains slightly painful (so far, what hurts most are string manipulation and literal array creation).
That simple triumvirate of "def", "var", and "val" is IMHO a brilliant distinctive feature of Scala. The "var"/"val" distinction is like a lightweight form of Haskell's heavyweight way of separating mutable state from pure (or assign-once) values, or of Java's heavyweight "final" keyword.
12:59:39 AM