I view myself as a polyglot when it comes to programming languages. I’ve picked up a several programming languages in my career thus far, and although I have a few that I consider my bread-and-butter languages, I have a soft spot for some languages I haven’t had the opportunity to use in a professional context. Most of the projects I’ve handled have been in more mainstream languages: Java, Python, a bit of Ruby here and there, and early on some C#. But man, I still have a fondness for Lisp and its dialects.
My first experience with Lisp wasn’t actually in Emacs, surprisingly
enough. I first encountered Lisp in a game called
Abuse1, back in
the 90s in high school. I remember futzing around the filesystem one
afternoon, just poking and proding at things, and saw these files with
.LSP – and surprise, they were text files: source
code for the behavior of the AI and the environment in the game. I
could tell that it was source code; even if I didn’t understand the
language, I could kind of tell what it was for.
I also remember looking over my friend Leandro’s shoulder as he played around with his dad’s copy of AutoCAD, demonstrating AutoLISP around the same time.
I was fascinated enough with the language that the parentheses didn’t bother me that much then, although to be fair, I’m probably viewing things with rose-colored glasses and all. Anyway, I remember trying to read up on it back in high school, pre-Wikipedia, and I remember not finding much on it in our school library – maybe a few mentions in some magazines, or a mention in an entry in the encyclopedia, or a passing remark in a few books on programming in BASIC – which just made me more interested in learning it.
I only began to really dable with Lisp when I started to learn Emacs, around college, and by then I was already pretty comfortable writing code in Java and C (and BASIC, natch – the first language I ever learned). Most of our school projects then were in Java, and I had a few personal projects in C, one of which was a template processor I was building I called MERGe to help me generated pages for my own blog. I was still editing stuff in Notepad and EditPad Lite, and in hindsight I don’t recall why I built MERGe in C, when I could have written it in Java. Who knows?
But back to Lisp.
The thing that still fascinates me with Lisp its homoiconicity: the
fact that code is data, that the language’s representation of code
is itself the same representation for data – and because of this,
Lisp allows you to write code that writes code. I mean, yeah, now I
understand enough to know how an interpreter or a compiler works, but
back then finding out about
eval and macros was heady stuff. You
mean I could write code that actually generates other code?
The thing is, I hadn’t ever coded in Lisp, and when I started learning it, it bled through to how I thought of code in the languages I was using day-to-day.
For instance, the whole idea that you could treat functions as values changed how I thought of some solutions in Java; instead of passing some sort of enum value to a method to direct its behavior, why not create a one-method interface and pass an anonymous inner class implementation, effectively passing a function that parameterizes the behavior of that method? Which I did, for one project at work, involving a gnarly problem with Oracle, Hibernate and “encrypted” column values2.
Of course, Lisp is not the end-all-be-all language; there is no silver bullet, after all, but I’m definitely happy that I learned it.
So that means learning other languages as well, not just Lisp.
Recently, I’ve started to do some personal projects in Clojure. I am still in awe of the tight feedback loop that a REPL can give you, even with the distinct overhead of starting up a Java virtual machine instance. I’ve started looking at Haskell more seriously, as a more strongly-typed counterpart to Lisp. I’m also starting to brush up on C++, particularly on C++14, the newest standard of the language – my last venture with the language was more than a decade ago, and I’ve been curious about what I can learn from it now. Template metaprogramming is still something of a bugbear of mine; maybe I’ll be able to really grok it this time around.
Of course, to be completely honest, I’ve been lucky thus far to have been able to actually handle projects in various programming languages. I do admit though that although I’ve done a lot of work in my bread-and-butter languages (Java and Python at the moment), I might not have the same depth of knowledge in those languages as other programmers.
There’s also the problem that the ways I express myself in other languages makes me sound like a foreigner of those languages, in a way. Sure, I’ve been able to leverage some things I’ve learned from Lisp or Ruby in Python or Java, but am I cutting with the grain, or am I making things more obtuse for the next developer? Thankfully, in the case of those languages I’ve been using for work, I’ve been lucky to have been exposed to the idioms of the community.
Would I recommend learning other programming languages? Absolutely, even if you’d use it for your own pet projects outside of work. Look at a language that looks interesting, and go through a tutorial or two. Maybe even rewrite one of your own pet projects in that language.
I mean, yeah, you might not use it directly at your day job, but having more tools to solve problems makes you a better engineer, I think, even if indirectly.