Oct '14

07

How I Learned to Stop Worrying and Love Parentheses

SquIRCy, or squishy, is an IRC bot which features a runtime scriptable engine. Go is the current flavor of the week, so naturally it was the choice for the project. I had been wanting to further my Go skills and this would be a great project to do that with. My previous introduction to Go was big-red, the big red button that pipes data over SSH between remote servers and stick, an unfinished port of the Twig templating engine.

It started with a simple idea: create a bot that is scriptable in some language other than Go. Expose this scripting API via IRC commands, allowing the bot to be dynamically scripted during runtime. There were a few options with Go: a fairly mature Javascript VM called otto, Lua language Go bindings, and a simple Lisp interpreter. Why not all three?

It was easy enough, with the very straightforward way to write Effective Go. Perusing other developers' Go code is amazingly trouble-free. Everyone formats their files the same, everyone uses the same conventions. 

Integrating ottojs was by far the most straightforward, with the Lua bindings following a close second. The Lisp interpreter I chose was fairly bare-bones, with no built in string handling and no way to call Go code from Lisp code. I forked a fork of the project and added the additional functionality.

In messing with the Lisp interpreter, I've become a little bit more familiar with the parenthetical family of languages. I learned things about Lisp syntax and scope and, a bit surprisingly, I learned that Lisp is not at all as cryptic as it first may seem. Avoidance of side effects comes naturally through defining single-purpose functions, and some bits of Lisp can seem almost poetic.

In setting out to understand Go, I've inadvertently become more familiar with Lisp and Lua. Each language differs in considerable ways and using each of them regularly for even just a short time has opened my mind to new paradigms. As far as Lisp, I can say that I'm no longer hesitant about functional programming. I can see its application and look forward to using it to solve problems.

Anyways, next up for squishy is a web management interface. Because scripting over IRC is stupid.

golispluajavascriptMiscellaneousLearning

Comments

omgwoo

I've never played with Go, Lisp, or Lua, but you've made it sound approachable enough that I'll give it a try soon.