Testing the waters of Lisp

Lately, I have been exploring Lisp, Common Lisp to be more exact and I have seen some of the stuff ways out of imagination. I am going to talk about two such feature here.

The next three paragraphs are giving the background of my relationship with programming languages and Lisp. Feel free to skip it and bite directly into the juice.

I can code in few languages and they belong to a wide range of paradigms. The first language I learned, in what can be said in depth was Java. I learnt it in my high school and later the deeper stuff in the first year of my college. I have also explored Ruby, Python, C, C++ and a few more languages. Having explored all these somehow made my perception of computer languages different. I could see the good points and bad points of all those languages and only opinion I had about languages are they are made of different kinds of stuff for different reasons and they are beautiful in themselves. And obviously, I either stayed out of language wars or supported both of them (more former than latter).

Almost exactly a year ago, one of my senior at college (Divij, for those who are interested in the name) posted a link of Paul Graham on Lisp in SDSLabs' slack chat. Being a "language neutralist" I was really marveled how can one so confidently claim that this language is a superior language. I have had heard such arguments before but what struck me was the example of the hypothetical language he gave. So I decided to try out Lisp and see what's all that people going crazy about.

I didn't just sit down and learn the language from top to bottom (I was too bored of learning languages ;) ). I explored it in parts. I read up Practical Common Lisp by Peter Seibel. Not fully, but I completed the language section and up to half of the practical sections.  Was not able to give to time to the rest. It was great experience mostly the macros and restarts. But I was not in full awe because I hadn't experienced them by myself.

That's the boring background, now let me give you the real juice!

The first time my jaw really dropped was when I was able to dynamically alter a running program from my text editor. If this didn't sink in, let me elaborate. I was in my text editor and I could alter the program running on my terminal without restarting it or loose any of my data (unless of course, if I change the data directly and yes, that also could be done). Isn't here development cycle cut right into the half? Just change the block and try. No restarting and setting up the data again. Well, actually that was the magic of SLIME and swank server but nevertheless, Lisp tools and the power of such flexible REPL.

So what I did was start the swank server with my program. Then I connected to the server from Emacs' SLIME instance and I was right in the REPL of the running program. I could modify the code in the file I was editing and sent it to REPL. Then from my next command on wards, it behaves differently. That's it. Isn't it cool? It was something like Ruby's pry, but instead of the terminal, I was in my text editor, editing the source code directly and without adding any special line in between my code. I know there might be more elegant way to connect but that's how I did it.

The next surprising thing happened today! I was trying out Woo webserver and it has a dependency named libev (an event library). I thought that it might already be installed on my computer so I tried to load woo directly though quicklisp. (quicklisp is another great dependency manager in CL toolbox, but this post is not about it). As this was the first time I was loading woo, it started downloading it and building it. Then in the middle of the build process, it realises that I don't have the dependent library. So, what do you guess happened? My program crashed, I installed the library and restarted the program, right?

Nope, it didn't happen! What happen was that, when it realised the it doesn't have the dependency, it paused and gave me 14 options to choose from. They ranged from try again, use another library, try recompiling the effected part to give up on woo.



So I decided to give it a try! I fired up another terminal, installed the library and chose the option to retry loading. And then my jaws dropped. I went on smoothly. And then I had the same expression of Janice in F.R.I.E.N.D.S.

It's a sad thing that such a cool language and such cool features are not in mainstream anymore.

Comments

Popular posts from this blog

Beginner's Guide to install Kali Linux in UEFI system (Lenovo Z510)

JSFuck is a bad security barrier.

Migrating from Gitolite with Redmine to Gitlab